name: Status check labels on: pull_request: types: [labeled, unlabeled] jobs: check: name: Check ${{ matrix.label }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: label: - needs-docs - merge-after-release - chained-pr steps: - name: Check for ${{ matrix.label }} label uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: | const { data: labels } = await github.rest.issues.listLabelsOnIssue({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number }); const hasLabel = labels.find(label => label.name === '${{ matrix.label }}'); if (hasLabel) { core.setFailed('Pull request cannot be merged, it is labeled as ${{ matrix.label }}'); }