From d0b036227aa7a0bb964599730a00ded1310ec781 Mon Sep 17 00:00:00 2001 From: Lai Jiang Date: Tue, 12 Mar 2024 22:47:37 -0400 Subject: [PATCH] Add a GitHub action to block merging based on the labels (#2367) --- .github/workflows/do-not-merge.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/do-not-merge.yml diff --git a/.github/workflows/do-not-merge.yml b/.github/workflows/do-not-merge.yml new file mode 100644 index 000000000..b5d109b57 --- /dev/null +++ b/.github/workflows/do-not-merge.yml @@ -0,0 +1,23 @@ +name: "Check labels" + +on: + pull_request: + branches: ["master"] + types: + - opened + - synchronize + - labeled + - unlabeled + merge_group: + branches: ["master"] + types: [checks_requested] + +jobs: + fail-by-label: + runs-on: ubuntu-latest + steps: + - name: Fail if PR is labeled as "do not merge" + if: contains(github.event.pull_request.labels.*.name, 'do not merge') + run: | + echo "This PR is labeled as do not merge!" + exit 1