Skip to content

commit to test the PR label checker #26

commit to test the PR label checker

commit to test the PR label checker #26

Workflow file for this run

# 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.');
}