Files
Meshtastic-Android/.github/workflows/pr_enforce_labels.yml
renovate[bot] f07624be88 chore(deps): update actions/github-script action to v9 (#5029)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-09 23:53:58 +00:00

27 lines
943 B
YAML

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