From 25e91e5e01d9606f3b1e3e36fae8ef0229d91b5c Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Tue, 4 Jul 2023 11:57:43 +0200 Subject: [PATCH] chore(ci): prevent merging PRs that do not meet minimum requirements --- .github/workflows/on_pr_updates.yml | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/on_pr_updates.yml diff --git a/.github/workflows/on_pr_updates.yml b/.github/workflows/on_pr_updates.yml new file mode 100644 index 00000000000..003bc0880a8 --- /dev/null +++ b/.github/workflows/on_pr_updates.yml @@ -0,0 +1,36 @@ +# Fail PR check if do-not-merge label is present +name: PR requirements + +# PROCESS +# +# 1. Verify whether 'do-not-merge' label is present +# 2. Fail PR to prevent merging until resolved +# 3. Pass PR if do-not-merge label is removed by a maintainer + +# USAGE +# +# Always triggered on PR labeling changes. + +# NOTES +# +# PR requirements are checked async in on_opened_pr.yml and enforced here synchronously +# due to limitations in GH API. + +on: + pull_request: + types: + - opened + - labeled + - unlabeled + +permissions: {} # no permission required + +jobs: + fail-for-draft: + runs-on: ubuntu-latest + steps: + - name: Block if it doesn't minimum requirements + if: contains(github.event.pull_request.labels.*.name, 'do-not-merge') + run: | + echo "This PR does not meet minimum requirements (check PR comments)." + exit 1