Add a GitHub action to block merging based on the labels (#2367)

This commit is contained in:
Lai Jiang 2024-03-12 22:47:37 -04:00 committed by GitHub
parent 0f02858965
commit d0b036227a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

23
.github/workflows/do-not-merge.yml vendored Normal file
View file

@ -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