@@ -18,64 +18,10 @@ concurrency:
1818 cancel-in-progress : true
1919
2020jobs :
21- # ── Auto-label ───────────────────────────────────────────────────
22- # 1. File paths → area labels (contracts, frontend, infrastructure, etc.)
23- # 2. PR title prefix → type labels (enhancement, bug, docs, etc.)
24- auto-label :
25- if : >-
26- github.event.action == 'opened' &&
27- github.event.pull_request.user.login != 'github-actions[bot]' &&
28- github.event.pull_request.user.login != 'release-please[bot]' &&
29- github.event.pull_request.user.login != 'dependabot[bot]'
30- runs-on : ubuntu-latest
31- steps :
32- - uses : actions/checkout@v6
33- - name : Label by file paths
34- uses : actions/labeler@v6
35- with :
36- repo-token : ${{ secrets.GITHUB_TOKEN }}
37- configuration-path : .github/labeler.yml
38- sync-labels : false
39-
40- - name : Label by PR title prefix
41- env :
42- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43- run : |
44- TITLE="${{ github.event.pull_request.title }}"
45- PR_NUM="${{ github.event.pull_request.number }}"
46- REPO="${{ github.repository }}"
47-
48- PREFIX=$(echo "$TITLE" | grep -oP '^\w+' || echo "")
49-
50- case "$PREFIX" in
51- feat) LABEL="enhancement" ;;
52- fix) LABEL="bug" ;;
53- docs) LABEL="documentation" ;;
54- refactor) LABEL="refactor" ;;
55- test) LABEL="tests" ;;
56- ci|build) LABEL="infrastructure" ;;
57- security) LABEL="security" ;;
58- perf) LABEL="enhancement" ;;
59- *) LABEL="" ;;
60- esac
61-
62- if [ -n "$LABEL" ]; then
63- HAS=$(gh pr view "$PR_NUM" --repo "$REPO" --json labels \
64- -q "[.labels[].name] | any(. == \"$LABEL\")")
65- if [ "$HAS" != "true" ]; then
66- gh pr edit "$PR_NUM" --repo "$REPO" --add-label "$LABEL"
67- echo "Added: $LABEL"
68- fi
69- fi
70-
7121 # ── PR quality checks ───────────────────────────────────────────
72- # Waits for auto-label so labels exist before we check them.
73- # !failure() lets this run when auto-label succeeds OR is skipped
74- # (skipped on labeled/unlabeled events), but blocks on failure.
22+ # Labels are managed by the reviewer, not automated.
7523 pr-checks :
76- needs : auto-label
7724 if : >-
78- !failure() &&
7925 github.event.pull_request.user.login != 'github-actions[bot]' &&
8026 github.event.pull_request.user.login != 'release-please[bot]' &&
8127 github.event.pull_request.user.login != 'dependabot[bot]'
@@ -146,19 +92,3 @@ jobs:
14692
14793 echo "::error::PR must link to an issue. Use 'Closes #N' in the description, or link via the Development sidebar. Add the 'no-issue' label for trivial changes."
14894 exit 1
149-
150- - name : Check labels
151- env :
152- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
153- run : |
154- # Re-fetch labels (auto-label may have just added some)
155- LABEL_COUNT=$(gh pr view ${{ github.event.pull_request.number }} \
156- --repo "${{ github.repository }}" --json labels \
157- -q '.labels | length')
158-
159- if [ "$LABEL_COUNT" -eq 0 ]; then
160- echo "::error::PR must have at least one label. Labels are usually added automatically from the PR title and changed files. If auto-labeling didn't trigger, add a label manually."
161- exit 1
162- fi
163-
164- echo "PR has $LABEL_COUNT label(s)"
0 commit comments