From f2697b630b53569ffdb4468c8f53b266f988caee Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 23 Dec 2024 17:28:51 +0100 Subject: [PATCH] GH Actions: add merge-conflict check This commit adds a new workflow which runs on pushes (merges) to any of the long-running branches and whenever the contents of a pull requests changes. It will check whether any open PRs are in a "conflict state" (after the push) and if so, will add a "merge conflict" label and leave a comment on the PR asking the OP to solve the conflict. The workflow will automatically remove the label again when the conflict is resolved. This workflow uses a reusable action stored in the `.github` repository which takes care of the default settings, though a number of settings can still be overruled for an individual repo. For now, it has not been deemed necessary to overrule these though. --- .github/workflows/merge-conflict-check.yml | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/merge-conflict-check.yml diff --git a/.github/workflows/merge-conflict-check.yml b/.github/workflows/merge-conflict-check.yml new file mode 100644 index 000000000..f7c913a69 --- /dev/null +++ b/.github/workflows/merge-conflict-check.yml @@ -0,0 +1,24 @@ +name: Check PRs for merge conflicts + +on: + # Check for new conflicts due to merges. + push: + branches: + - main + - trunk + - 'release/**' + - 'hotfix/[0-9]+.[0-9]+*' + - 'feature/**' + # Check conflicts in new PRs and for resolved conflicts due to an open PR being updated. + pull_request_target: + types: + - opened + - synchronize + - reopened + +jobs: + check-prs: + if: github.repository_owner == 'Yoast' + + name: Check PRs for merge conflicts + uses: Yoast/.github/.github/workflows/reusable-merge-conflict-check.yml@main