-
Notifications
You must be signed in to change notification settings - Fork 2
143 lines (118 loc) · 6.02 KB
/
semantic-labeler.yml
File metadata and controls
143 lines (118 loc) · 6.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# yamllint disable rule:line-length
name: Semantic Labeler
# Claude-powered semantic labeling for both issues and PRs
# Replaces the path-based labeler with content-aware categorization
on:
issues:
types: [opened, edited]
pull_request:
types: [opened, synchronize, edited]
# Cancel in-progress runs on subsequent triggers
concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number || github.event.pull_request.number }}
cancel-in-progress: true
jobs:
label-issue:
name: Label Issue
# Skip bot-created issues to prevent potential loops
if: |
github.event_name == 'issues' &&
github.actor != 'dependabot[bot]' &&
github.actor != 'claude[bot]'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
issues: write
id-token: write
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
persist-credentials: false
- name: Label issue with Claude
id: labeler
uses: anthropics/claude-code-action@220272d38887a1caed373da96a9ffdb0919c26cc # v1.0.65
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
Label GitHub issue #${{ github.event.issue.number }}.
**Title**: ${{ github.event.issue.title }}
**Author**: ${{ github.event.issue.user.login }}
**Body**:
${{ github.event.issue.body }}
## Instructions
1. **Get available labels**: `gh label list --json name,description -q '.[] | "\(.name): \(.description)"'`
2. **Get current labels**: `gh issue view ${{ github.event.issue.number }} --json labels -q '.labels[].name'`
3. **Analyze** the issue content and determine appropriate labels
4. **Apply labels** using `gh issue edit`, removing conflicting mutually-exclusive labels first
## Label Rules (see .github/LABELS.md for full details)
**Required (exactly ONE each):**
- TYPE: bug | enhancement | documentation | question | refactor | chore
- PRIORITY: priority:critical | priority:high | priority:medium | priority:low
- EFFORT: effort:small | effort:medium | effort:large
**Contextual (apply only if clearly relevant):**
- COMPONENT: component:skill | component:agent | component:command | component:hook | component:docs | github-actions
- SPECIAL: breaking | security
- COMMUNITY: help wanted | good first issue (only if clearly appropriate)
## Execution
For mutually exclusive categories (type, priority, effort), remove existing labels before adding new ones:
```bash
gh issue edit ${{ github.event.issue.number }} --remove-label "priority:low" --add-label "priority:high,bug,effort:medium"
```
After applying labels, briefly explain your reasoning.
claude_args: '--model claude-opus-4-6 --allowedTools "Bash(gh label:*),Bash(gh issue:*)"'
label-pr:
name: Label Pull Request
if: |
github.event_name == 'pull_request' &&
github.actor != 'dependabot[bot]' &&
github.actor != 'claude[bot]' &&
github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: write
id-token: write
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
persist-credentials: false
- name: Label PR with Claude
id: labeler
uses: anthropics/claude-code-action@220272d38887a1caed373da96a9ffdb0919c26cc # v1.0.65
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
Label pull request #${{ github.event.pull_request.number }}.
**Title**: ${{ github.event.pull_request.title }}
**Author**: ${{ github.event.pull_request.user.login }}
**Description**:
${{ github.event.pull_request.body }}
## Instructions
1. **Get available labels**: `gh label list --json name,description -q '.[] | "\(.name): \(.description)"'`
2. **Get current labels**: `gh pr view ${{ github.event.pull_request.number }} --json labels -q '.labels[].name'`
3. **Get the PR diff** to understand what changed: `gh pr diff ${{ github.event.pull_request.number }}`
4. **Read key modified files** to understand context - use Read and Glob tools to examine important changed files in detail
5. **Analyze** the changes and determine appropriate labels
6. **Apply labels** using `gh pr edit`, removing conflicting mutually-exclusive labels first
## Label Rules (see .github/LABELS.md for full details)
**Required (exactly ONE each):**
- TYPE (based on nature of changes): bug | enhancement | documentation | refactor | chore
- EFFORT (based on diff size/complexity): effort:small | effort:medium | effort:large
**Contextual (apply based on files changed):**
- COMPONENT: component:skill (skills/**) | component:agent (agents/**) | component:command (commands/**) | component:hook (hooks/**) | component:docs (*.md, .github/**/*.md) | github-actions (.github/workflows/**)
- SPECIAL: breaking | security
## Execution
For mutually exclusive categories (type, effort), remove existing labels before adding new ones:
```bash
gh pr edit ${{ github.event.pull_request.number }} --remove-label "effort:small" --add-label "effort:medium,enhancement,component:skill"
```
After applying labels, briefly explain your reasoning.
claude_args: '--model claude-opus-4-6 --allowedTools "Bash(gh label:*),Bash(gh pr:*),Read,Glob"'