# This workflow checks open PRs for merge conflicts and labels them when conflicts are found
name: Check for merge conflicts

# Run whenever the "main" branch is updated
# NOTE: This means merge conflicts are only checked for when a PR is merged to main.
on:
  push:
    branches:
      - main

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
      # See: https://github.com/mschilde/auto-label-merge-conflicts/
      - name: Auto-label PRs with merge conflicts
        uses: mschilde/auto-label-merge-conflicts@v2.0
        # Add "merge conflict" label if a merge conflict is detected. Remove it when resolved.
        # Note, the authentication token is created automatically
        # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token
        with:
          CONFLICT_LABEL_NAME: 'merge conflict'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        # Ignore errors
        continue-on-error: true
