File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,27 @@ permissions:
1010 contents : read
1111
1212jobs :
13+ check-pr-labels :
14+ name : ' Check PR Labels'
15+ runs-on : ubuntu-latest
16+ if : github.event_name == 'pull_request'
17+
18+ steps :
19+ - name : " Check for type: label"
20+ env :
21+ GH_TOKEN : ${{ github.token }}
22+ PR_NUMBER : ${{ github.event.pull_request.number }}
23+ run : |
24+ # Fetch at runtime so that re-running a failed workflow
25+ # after adding a label will pick up the newly added label.
26+ LABELS=$(gh api "repos/${{ github.repository }}/issues/${PR_NUMBER}/labels" --jq '.[].name')
27+ if echo "$LABELS" | grep -qE '^type: '; then
28+ echo "PR has a valid 'type: ' label."
29+ else
30+ echo "Error: PR must have at least one label starting with 'type: '."
31+ exit 1
32+ fi
33+
1334 smoke-test-drafter :
1435 name : ' Smoke Test for Drafter'
1536 runs-on : ubuntu-latest
You can’t perform that action at this time.
0 commit comments