From 092af3285d33acfec43c1f6af272a9fc4e230fae Mon Sep 17 00:00:00 2001 From: Lai Jiang Date: Tue, 12 Mar 2024 21:41:27 -0400 Subject: [PATCH] Add a GitHub action to block merging based on the labels (#2367) --- .github/workflows/do-not-merge.yml | 21 +++++++++++++++++++++ 1 file changed, 21 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 0000000000..8e1d0624ca --- /dev/null +++ b/.github/workflows/do-not-merge.yml @@ -0,0 +1,21 @@ +name: "Check labels" + +on: + pull_request: + branches: [ "master" ] + types: + - opened + - synchronize + - labeled + - unlabeled + - enqueued + +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