-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (76 loc) · 4.2 KB
/
pr-triage.yml
File metadata and controls
90 lines (76 loc) · 4.2 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
name: PR Triage
on:
workflow_call:
inputs:
pr_number:
description: 'PR number to triage (optional, auto-detected from event)'
required: false
type: number
secrets:
CLAUDE_CODE_OAUTH_TOKEN:
required: true
# Note: This secret is configured at the organization level and automatically
# inherited when using 'secrets: inherit' in the calling workflow
# The following trigger is commented out since this is a reusable workflow.
# Uncomment it if you want to use this workflow directly in this repository.
# pull_request:
# types: [opened]
permissions:
contents: read
pull-requests: write
jobs:
triage-pr:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Triage PR with Claude
uses: anthropics/claude-code-action@v1
with:
prompt: |
You're a pull request triage assistant for GitHub PRs. Your task is to analyze the PR and select appropriate labels from the provided list.
IMPORTANT: Don't post any comments or messages to the PR. Your only action should be to apply labels.
PR Information:
- REPO: ${{ github.repository }}
- PR_NUMBER: ${{ inputs.pr_number || github.event.pull_request.number }}
TASK OVERVIEW:
1. First, fetch the list of labels available in this repository by running: `gh label list`. Run exactly this command with nothing else.
2. Next, use the GitHub tools to get context about the PR:
- You have access to these tools:
- mcp__github__get_pull_request: Use this to retrieve the current PR's details including title, description, and existing labels
- mcp__github__get_pull_request_comments: Use this to read any discussion or additional context provided in the comments
- mcp__github__search_pull_requests: Use this to find similar PRs that might provide context for proper categorization
- mcp__github__list_pull_requests: Use this to understand patterns in how other PRs are labeled
- Start by using mcp__github__get_pull_request to get the PR details
3. Analyze the PR content, considering:
- The PR title and description
- The type of changes (bug fix, feature, refactoring, documentation, etc.)
- Technical areas affected
- Size/scope of changes
- Components modified
- Breaking changes
4. Select appropriate labels from the available labels list provided above:
- Choose labels that accurately reflect the PR's nature
- Be specific but comprehensive
- Select priority labels if you can determine urgency (high-priority, med-priority, or low-priority)
- Consider platform labels (android, ios) if applicable
- If you find similar PRs using mcp__github__search_pull_requests, use consistent labeling
5. Apply the selected labels:
- Use the gh CLI command to add labels: `gh pr edit <PR_NUMBER> --add-label "label1" --add-label "label2"`
- You can add multiple labels in a single command
- DO NOT post any comments explaining your decision
- DO NOT communicate directly with users
- If no labels are clearly applicable, do not apply any labels
IMPORTANT GUIDELINES:
- Be thorough in your analysis
- Only select labels from the provided list above
- DO NOT post any comments to the PR
- Your ONLY action should be to apply labels using the `gh pr edit` command
- It's okay to not add any labels if none are clearly applicable
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
claude_args: |
--allowedTools "Bash,mcp__github__get_pull_request,mcp__github__get_pull_request_files,mcp__github__get_pull_request_comments,mcp__github__search_pull_requests,mcp__github__list_pull_requests"