labeler tweaks (#2617)

This commit is contained in:
DaneEvans 2025-08-03 02:08:45 +10:00 committed by GitHub
parent f7eb10c17b
commit 2daf1ba67b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 35 deletions

25
.github/workflows/pr_enforce_labels.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: Check PR Labels
on:
pull_request:
types: [edited, labeled]
permissions:
pull-requests: read
contents: read
jobs:
check-label:
runs-on: ubuntu-latest
steps:
- name: Check for PR labels
uses: actions/github-script@v7
with:
script: |
const labels = context.payload.pull_request.labels.map(label => label.name);
const requiredLabels = ['bugfix', 'enhancement', 'automation', 'dependencies', 'repo', 'release'];
const hasRequiredLabel = labels.some(label => requiredLabels.includes(label));
console.log(labels);
if (!hasRequiredLabel) {
core.setFailed(`PR must have at least one of the following labels before it can be merged: ${requiredLabels.join(', ')}.`);
}