Skip to content

Commit 3e34b07

Browse files
authored
Merge pull request #4911 from kirodotdev/amaktala/triage
feat: add comprehensive GitHub issue automation system
2 parents 56fee03 + 15543da commit 3e34b07

43 files changed

Lines changed: 12080 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/README.md

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
# GitHub Issue Automation Workflows
2+
3+
This directory contains automated workflows for managing GitHub issues using AWS Bedrock AI.
4+
5+
## Overview
6+
7+
The automation system provides:
8+
- **Automatic Label Assignment** - AI-powered classification of issues
9+
- **Duplicate Detection** - Semantic similarity analysis to find duplicate issues
10+
- **Duplicate Closure** - Automatic closure of confirmed duplicates after 3 days
11+
- **Stale Issue Management** - Closure of inactive issues after 7 days
12+
13+
## Workflows
14+
15+
### 1. Issue Triage (`issue-triage.yml`)
16+
17+
**Trigger:** When a new issue is opened
18+
19+
**What it does:**
20+
1. Analyzes the issue title and body using AWS Bedrock Claude Sonnet 4.5
21+
2. Assigns relevant labels from the predefined taxonomy
22+
3. Detects potential duplicate issues
23+
4. Posts a comment if duplicates are found
24+
5. Adds the "duplicate" label if applicable
25+
26+
**Required Secrets:**
27+
- `AWS_ACCESS_KEY_ID` - AWS access key with Bedrock permissions
28+
- `AWS_SECRET_ACCESS_KEY` - AWS secret access key
29+
- `AWS_REGION` (optional) - AWS region, defaults to us-east-1
30+
- `GITHUB_TOKEN` - Automatically provided by GitHub Actions
31+
32+
### 2. Close Duplicates (`close-duplicates.yml`)
33+
34+
**Trigger:** Daily at midnight UTC (or manual)
35+
36+
**What it does:**
37+
1. Finds all open issues with the "duplicate" label
38+
2. Checks how long the label has been applied
39+
3. Closes issues where the label has been present for 3+ days
40+
4. Posts a closing comment with reference to the original issue
41+
42+
**Manual Trigger:**
43+
```bash
44+
gh workflow run close-duplicates.yml
45+
```
46+
47+
### 3. Close Stale Issues (`close-stale.yml`)
48+
49+
**Trigger:** Daily at midnight UTC (or manual)
50+
51+
**What it does:**
52+
1. Finds all open issues with the "pending-response" label
53+
2. Checks the last activity date (comments or label changes)
54+
3. Closes issues with no activity for 7+ days
55+
4. Posts a closing comment explaining the inactivity
56+
57+
**Manual Trigger:**
58+
```bash
59+
gh workflow run close-stale.yml
60+
```
61+
62+
## Setup Instructions
63+
64+
### 1. AWS Bedrock Access
65+
66+
Ensure you have access to AWS Bedrock with the Claude Sonnet 4.5 model:
67+
68+
1. Enable Bedrock in your AWS account
69+
2. Request access to the Claude Sonnet 4 model
70+
3. Create an IAM user with the following permissions:
71+
72+
```json
73+
{
74+
"Version": "2012-10-17",
75+
"Statement": [
76+
{
77+
"Effect": "Allow",
78+
"Action": [
79+
"bedrock:InvokeModel"
80+
],
81+
"Resource": "arn:aws:bedrock:*::foundation-model/anthropic.claude-sonnet-4-*"
82+
}
83+
]
84+
}
85+
```
86+
87+
**Note:** The system uses inference profile ID `us.anthropic.claude-sonnet-4-20250514-v1:0` for cross-region routing and higher throughput.
88+
89+
### 2. GitHub Secrets
90+
91+
Add the following secrets to your repository:
92+
93+
1. Go to Settings → Secrets and variables → Actions
94+
2. Add the following secrets:
95+
- `AWS_ACCESS_KEY_ID` - Your AWS access key ID
96+
- `AWS_SECRET_ACCESS_KEY` - Your AWS secret access key
97+
- (Optional) `AWS_REGION` - AWS region, defaults to us-east-1
98+
99+
### 3. Labels
100+
101+
Create the following labels in your repository:
102+
103+
**Feature/Component Labels:**
104+
- auth, autocomplete, chat, cli, extensions, hooks, ide, mcp, models, powers, specs, ssh, steering, sub-agents, terminal, ui, usability, trusted-commands, pricing, documentation, dependencies, compaction
105+
106+
**OS-Specific Labels:**
107+
- os: linux, os: mac, os: windows
108+
109+
**Theme Labels:**
110+
- theme:account, theme:agent-latency, theme:agent-quality, theme:context-limit-issue, theme:ide-performance, theme:slow-unresponsive, theme:ssh-wsl, theme:unexpected-error
111+
112+
**Workflow Labels:**
113+
- pending-maintainer-response, pending-response, pending-triage, duplicate, question
114+
115+
**Special Labels:**
116+
- Autonomous agent, Inline chat, on boarding
117+
118+
You can create labels manually or use the GitHub CLI:
119+
120+
```bash
121+
gh label create "pending-triage" --color "fbca04" --description "Awaiting maintainer review"
122+
gh label create "duplicate" --color "cfd3d7" --description "This issue is a duplicate"
123+
gh label create "pending-response" --color "d4c5f9" --description "Awaiting response from issue author"
124+
# ... add more labels as needed
125+
```
126+
127+
### 4. Install Dependencies
128+
129+
The workflows automatically install dependencies, but for local development:
130+
131+
```bash
132+
cd scripts
133+
npm install
134+
npm run build
135+
```
136+
137+
## Troubleshooting
138+
139+
### Workflow Fails with AWS Authentication Error
140+
141+
**Problem:** `UnrecognizedClientException` or authentication errors
142+
143+
**Solution:**
144+
1. Verify AWS credentials are correctly set in GitHub Secrets
145+
2. Ensure the IAM user has Bedrock permissions
146+
3. Check that the AWS region is correct
147+
148+
### No Labels Are Applied
149+
150+
**Problem:** Issues are created but no labels are added
151+
152+
**Solution:**
153+
1. Check the workflow run logs for errors
154+
2. Verify the labels exist in the repository
155+
3. Ensure the Bedrock API is responding correctly
156+
157+
### Duplicate Detection Not Working
158+
159+
**Problem:** Duplicates are not being detected
160+
161+
**Solution:**
162+
1. Check that there are existing open issues to compare against
163+
2. Verify AWS Bedrock access is working
164+
3. Review the similarity threshold (currently 0.80)
165+
166+
### Rate Limiting Issues
167+
168+
**Problem:** Workflows fail due to GitHub API rate limits
169+
170+
**Solution:**
171+
1. The workflows include rate limit handling
172+
2. For high-volume repositories, consider adjusting batch sizes
173+
3. Check the rate limit status: `gh api rate_limit`
174+
175+
## Monitoring
176+
177+
### Workflow Run Summaries
178+
179+
Each workflow generates a summary visible in the Actions tab:
180+
- Total issues processed
181+
- Success/failure counts
182+
- Detailed error information
183+
184+
### Logs
185+
186+
View detailed logs for each workflow run:
187+
1. Go to Actions tab
188+
2. Select the workflow
189+
3. Click on a specific run
190+
4. Expand the steps to see detailed logs
191+
192+
## Customization
193+
194+
### Adjusting Thresholds
195+
196+
Edit the TypeScript files in `scripts/`:
197+
198+
**Duplicate closure threshold (default: 3 days):**
199+
```typescript
200+
// In close_duplicates.ts
201+
const DAYS_THRESHOLD = 3;
202+
```
203+
204+
**Stale issue threshold (default: 7 days):**
205+
```typescript
206+
// In close_stale.ts
207+
const DAYS_THRESHOLD = 7;
208+
```
209+
210+
**Duplicate similarity threshold (default: 0.80):**
211+
```typescript
212+
// In detect_duplicates.ts
213+
const SIMILARITY_THRESHOLD = 0.8;
214+
```
215+
216+
### Modifying Schedules
217+
218+
Edit the cron expressions in the workflow files:
219+
220+
```yaml
221+
on:
222+
schedule:
223+
- cron: "0 0 * * *" # Daily at midnight UTC
224+
```
225+
226+
## Support
227+
228+
For issues or questions:
229+
1. Check the workflow run logs
230+
2. Review the troubleshooting section
231+
3. Open an issue in the repository
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Close Duplicate Issues
2+
3+
on:
4+
schedule:
5+
# Run daily at midnight UTC
6+
- cron: "0 0 * * *"
7+
workflow_dispatch: # Allow manual trigger
8+
9+
permissions:
10+
issues: write
11+
contents: read
12+
13+
jobs:
14+
close-duplicates:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "20"
24+
25+
- name: Install dependencies
26+
working-directory: scripts
27+
run: npm install
28+
29+
- name: Build TypeScript
30+
working-directory: scripts
31+
run: npm run build
32+
33+
- name: Close duplicate issues
34+
working-directory: scripts
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
REPOSITORY_OWNER: ${{ github.repository_owner }}
38+
REPOSITORY_NAME: ${{ github.event.repository.name }}
39+
run: node dist/close_duplicates.js
40+
41+
- name: Create workflow summary
42+
if: always()
43+
run: |
44+
echo "## Duplicate Closer Summary" >> $GITHUB_STEP_SUMMARY
45+
echo "Status: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
46+
echo "Run time: $(date)" >> $GITHUB_STEP_SUMMARY

.github/workflows/close-stale.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Close Stale Issues
2+
3+
on:
4+
schedule:
5+
# Run daily at midnight UTC
6+
- cron: "0 0 * * *"
7+
workflow_dispatch: # Allow manual trigger
8+
9+
permissions:
10+
issues: write
11+
contents: read
12+
13+
jobs:
14+
close-stale:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "20"
24+
25+
- name: Install dependencies
26+
working-directory: scripts
27+
run: npm install
28+
29+
- name: Build TypeScript
30+
working-directory: scripts
31+
run: npm run build
32+
33+
- name: Close stale issues
34+
working-directory: scripts
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
REPOSITORY_OWNER: ${{ github.repository_owner }}
38+
REPOSITORY_NAME: ${{ github.event.repository.name }}
39+
run: node dist/close_stale.js
40+
41+
- name: Create workflow summary
42+
if: always()
43+
run: |
44+
echo "## Stale Issue Closer Summary" >> $GITHUB_STEP_SUMMARY
45+
echo "Status: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
46+
echo "Run time: $(date)" >> $GITHUB_STEP_SUMMARY

.github/workflows/issue-triage.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Issue Triage
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
permissions:
8+
issues: write
9+
contents: read
10+
11+
jobs:
12+
triage:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "20"
22+
23+
- name: Install dependencies
24+
working-directory: scripts
25+
run: npm install
26+
27+
- name: Build TypeScript
28+
working-directory: scripts
29+
run: npm run build
30+
31+
- name: Run issue triage
32+
working-directory: scripts
33+
env:
34+
AWS_REGION: ${{ secrets.AWS_REGION || 'us-east-1' }}
35+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
36+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
ISSUE_NUMBER: ${{ github.event.issue.number }}
39+
ISSUE_TITLE: ${{ github.event.issue.title }}
40+
ISSUE_BODY: ${{ github.event.issue.body }}
41+
REPOSITORY_OWNER: ${{ github.repository_owner }}
42+
REPOSITORY_NAME: ${{ github.event.repository.name }}
43+
run: node dist/triage_issue.js
44+
45+
- name: Create workflow summary
46+
if: always()
47+
env:
48+
ISSUE_NUMBER: ${{ github.event.issue.number }}
49+
ISSUE_TITLE: ${{ github.event.issue.title }}
50+
run: |
51+
echo "## Issue Triage Summary" >> "$GITHUB_STEP_SUMMARY"
52+
echo "Issue #$ISSUE_NUMBER: $ISSUE_TITLE" >> "$GITHUB_STEP_SUMMARY"
53+
echo "Status: ${{ job.status }}" >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)