Meshtastic-Android/.github/workflows/pr_enforce_labels.yml
James Rich 93e711e0f2 fix: scope labeler trigger to opened/synchronize and fix bugfix typo
- Restrict pull-request-target.yml to only 'opened' and 'synchronize'
  events to reduce unnecessary API calls that exhaust the rate limit
- Fix 'bugpost' typo back to 'bugfix' in pr_enforce_labels.yml
2026-04-09 12:22:44 -05:00

26 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@v8
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(', ')}.`);
}