Skip to content

Commit 3a566de

Browse files
committed
[Testing] Try the enforce labels PR on self-hosted runners.
This should be reverted after testing passes.
1 parent fb94617 commit 3a566de

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Check PR Labels
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, labeled, unlabeled, synchronize, reopened]
6+
7+
permissions:
8+
pull-requests: read
9+
contents: read
10+
11+
jobs:
12+
check-label:
13+
runs-on: fifield
14+
steps:
15+
- name: Check for PR labels
16+
uses: actions/github-script@v8
17+
with:
18+
script: |
19+
const labels = context.payload.pull_request.labels.map(label => label.name);
20+
const requiredLabels = ['bugfix', 'enhancement', 'hardware-support', 'dependencies', 'submodules', 'github_actions', 'trunk'];
21+
const hasRequiredLabel = labels.some(label => requiredLabels.includes(label));
22+
if (!hasRequiredLabel) {
23+
core.setFailed(`PR must have at least one of the following labels before it can be merged: ${requiredLabels.join(', ')}.`);
24+
}

0 commit comments

Comments
 (0)