commit to test the PR label checker #25
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
# 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 | |
# don't run on forks | |
#if: github.repository == 'yt-project/yt' | |
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.'); | |
} |