forked from yt-project/yt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GH actions workflow to check PR labels
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# based on https://stackoverflow.com/a/75036059 and | ||
# https://github.com/astropy/astropy/blob/main/.github/workflows/check_milestone.yml | ||
name: Check PR labels | ||
|
||
on: | ||
# So it cannot be skipped. | ||
pull_request_target: | ||
types: [opened, synchronize, labeled, unlabeled] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-labels: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const requiredLabels = ['bug', 'enhancement', 'new feature', 'docs', 'infrastructure', 'dead code', 'refactor']; | ||
let labels = context.payload.pull_request.labels; | ||
core.info(`Current labels: ${labels.map(l => l.name).join(', ')}`); | ||
if (labels.filter(l => requiredLabels.includes(l.name)).length === 0) { | ||
core.setFailed('Please label this pull request with one of: bug, enhancement, new feature, docs or infrastructure.'); | ||
} |