Add issue management automation tools

This commit is contained in:
Lea Anthony 2025-05-14 20:46:51 +10:00
commit 594e2bf60f
No known key found for this signature in database
GPG key ID: 33DAF7BB90A58405
9 changed files with 800 additions and 6 deletions

View file

@ -0,0 +1,123 @@
# Wails Issue Management Automation
This directory contains automation workflows and scripts to help manage the Wails project with minimal time investment.
## GitHub Workflow Files
### 1. Auto-Label Issues (`auto-label-issues.yml`)
- Automatically labels issues and PRs based on their content and modified files
- Labels are defined in `issue-labeler.yml` and `file-labeler.yml`
- Activates when issues are opened, edited, or reopened
### 2. Issue Triage Automation (`issue-triage-automation.yml`)
- Performs automated actions for issue triage
- Requests more info for incomplete bug reports
- Prioritizes security issues
- Adds issues to appropriate project boards
## Configuration Files
### 1. Issue Content Labeler (`issue-labeler.yml`)
- Defines patterns to match in issue title/body
- Categorizes by version (v2/v3), component, type, and priority
- Customize patterns as needed for your project
### 2. File Path Labeler (`file-labeler.yml`)
- Labels PRs based on which files they modify
- Helps identify which areas of the codebase are affected
- Customize file patterns as needed
### 3. Stale Issues Config (`stale.yml`)
- Marks issues as stale after 45 days of inactivity
- Closes stale issues after an additional 10 days
- Exempts issues with important labels
## Helper Scripts
### 1. Issue Triage Script (`scripts/issue-triage.ps1`)
- PowerShell script to quickly triage issues
- Lists recent issues needing attention
- Provides easy keyboard shortcuts for common actions
- Run during your dedicated issue triage time
### 2. PR Review Helper (`scripts/pr-review-helper.ps1`)
- PowerShell script to efficiently review PRs
- Generates review checklists
- Provides easy shortcuts for common review actions
- Run during your dedicated PR review time
## How to Use This System
### Daily Workflow (2 hours max)
**Monday (120 min):**
1. Run `scripts/issue-triage.ps1` (30 min)
2. Run `scripts/pr-review-helper.ps1` (30 min)
3. Check Discord for critical discussions (30 min)
4. Plan your week (30 min)
**Tuesday-Wednesday (120 min/day):**
1. Quick check for urgent issues (10 min)
2. v3 development (110 min)
**Thursday (120 min):**
1. v2 maintenance (90 min)
2. Documentation updates (30 min)
**Friday (120 min):**
1. Run `scripts/pr-review-helper.ps1` (60 min)
2. Discord updates/newsletter (30 min)
3. Weekly reflection (30 min)
## Installation
1. The GitHub workflow files should be placed in `.github/workflows/`
2. Configuration files should be placed in `.github/`
3. Helper scripts should be placed in `scripts/`
4. Make sure you have GitHub CLI (`gh`) installed and authenticated
## Customization
Feel free to modify the configuration files and scripts to better suit your project's needs:
1. **Adding New Label Categories**:
- Add new patterns to `issue-labeler.yml` for additional components or types
- Update `file-labeler.yml` if you add new directories or file types
2. **Adjusting Automation Thresholds**:
- Modify `stale.yml` to change how long issues remain active
- Update `issue-triage-automation.yml` to change conditions for automated actions
3. **Customizing Scripts**:
- Update the scripts with your specific GitHub username
- Add additional actions based on your workflow preferences
- Adjust time allocations based on which tasks need more attention
## Benefits
This automated issue management system will:
1. **Save Time**: Reduce manual triage of most common issues
2. **Improve Consistency**: Apply the same categorization rules every time
3. **Increase Visibility**: Clear categorization helps community members find issues
4. **Focus Development**: Clearer separation of v2 and v3 work
5. **Reduce Backlog**: Better management of stale issues
6. **Streamline Reviews**: Faster PR processing with guided workflows
## Requirements
- GitHub CLI (`gh`) installed and authenticated
- PowerShell 5.1+ for Windows scripts
- GitHub Actions enabled on your repository
- Appropriate permissions to modify workflows
## Maintenance
This system requires minimal maintenance:
- Periodically review and update label patterns as your project evolves
- Adjust time allocations based on where you need to focus
- Update scripts if GitHub CLI commands change
- Customize the workflow as you find pain points in your process
Remember that the goal is to maximize your limited time (2 hours per day) by automating repetitive tasks and streamlining essential ones.

108
scripts/issue-triage.ps1 Normal file
View file

@ -0,0 +1,108 @@
# issue-triage.ps1 - Script to help with quick issue triage
# Run this at the start of your GitHub time to quickly process issues
# Set your GitHub username
$GITHUB_USERNAME = "your-username"
# Get the latest 10 open issues that aren't assigned and aren't labeled as "awaiting feedback"
Write-Host "Fetching recent unprocessed issues..."
gh issue list --repo wailsapp/wails --limit 10 --json number,title,labels,assignees | Out-File -Encoding utf8 -FilePath "issues_temp.json"
$issues = Get-Content -Raw -Path "issues_temp.json" | ConvertFrom-Json
$newIssues = $issues | Where-Object {
$_.assignees.Count -eq 0 -and
($_.labels.Count -eq 0 -or -not ($_.labels | Where-Object { $_.name -eq "awaiting feedback" }))
}
# Process each issue
Write-Host "`n===== Issues Needing Triage =====`n"
foreach ($issue in $newIssues) {
$number = $issue.number
$title = $issue.title
$labelNames = $issue.labels | ForEach-Object { $_.name }
$labelsStr = if ($labelNames) { $labelNames -join ", " } else { "none" }
Write-Host "Issue #$number`: $title"
Write-Host "Labels: $labelsStr`n"
$continue = $true
while ($continue) {
Write-Host "Options:"
Write-Host " [v] View issue in browser"
Write-Host " [2] Add v2-only label"
Write-Host " [3] Add v3-alpha label"
Write-Host " [b] Add bug label"
Write-Host " [e] Add enhancement label"
Write-Host " [d] Add documentation label"
Write-Host " [w] Add webview2 label"
Write-Host " [f] Request more info (awaiting feedback)"
Write-Host " [c] Close issue (duplicate/invalid)"
Write-Host " [a] Assign to yourself"
Write-Host " [s] Skip to next issue"
Write-Host " [q] Quit script"
$action = Read-Host "Enter action"
switch ($action) {
"v" {
gh issue view $number --repo wailsapp/wails --web
}
"2" {
Write-Host "Adding v2-only label..."
gh issue edit $number --repo wailsapp/wails --add-label "v2-only"
}
"3" {
Write-Host "Adding v3-alpha label..."
gh issue edit $number --repo wailsapp/wails --add-label "v3-alpha"
}
"b" {
Write-Host "Adding bug label..."
gh issue edit $number --repo wailsapp/wails --add-label "Bug"
}
"e" {
Write-Host "Adding enhancement label..."
gh issue edit $number --repo wailsapp/wails --add-label "Enhancement"
}
"d" {
Write-Host "Adding documentation label..."
gh issue edit $number --repo wailsapp/wails --add-label "Documentation"
}
"w" {
Write-Host "Adding webview2 label..."
gh issue edit $number --repo wailsapp/wails --add-label "webview2"
}
"f" {
Write-Host "Requesting more info..."
gh issue comment $number --repo wailsapp/wails --body "Thank you for reporting this issue. Could you please provide additional information to help us investigate?`n`n- [Specific details needed]`n`nThis will help us address your issue more effectively."
gh issue edit $number --repo wailsapp/wails --add-label "awaiting feedback"
}
"c" {
$reason = Read-Host "Reason for closing (duplicate/invalid/etc)"
gh issue comment $number --repo wailsapp/wails --body "Closing this issue: $reason"
gh issue close $number --repo wailsapp/wails
}
"a" {
Write-Host "Assigning to yourself..."
gh issue edit $number --repo wailsapp/wails --add-assignee "$GITHUB_USERNAME"
}
"s" {
Write-Host "Skipping to next issue..."
$continue = $false
}
"q" {
Write-Host "Exiting script."
exit
}
default {
Write-Host "Invalid option. Please try again."
}
}
Write-Host ""
}
Write-Host "--------------------------------`n"
}
Write-Host "No more issues to triage!"
# Clean up temp file
Remove-Item -Path "issues_temp.json"

103
scripts/issue-triage.sh Normal file
View file

@ -0,0 +1,103 @@
#!/bin/bash
# issue-triage.sh - Script to help with quick issue triage
# Run this at the start of your GitHub time to quickly process issues
# Set your GitHub username
GITHUB_USERNAME="your-username"
# Get the latest 10 open issues that aren't assigned and aren't labeled as "awaiting feedback"
echo "Fetching recent unprocessed issues..."
gh issue list --repo wailsapp/wails --limit 10 --json number,title,labels,assignees --jq '.[] | select(.assignees | length == 0) | select(any(.labels[]; .name != "awaiting feedback"))' > new_issues.json
# Process each issue
echo -e "\n===== Issues Needing Triage =====\n"
cat new_issues.json | jq -c '.[]' | while read -r issue; do
number=$(echo $issue | jq -r '.number')
title=$(echo $issue | jq -r '.title')
labels=$(echo $issue | jq -r '.labels[] | .name' 2>/dev/null | tr '\n' ', ' | sed 's/,$//')
if [ -z "$labels" ]; then
labels="none"
fi
echo -e "Issue #$number: $title"
echo -e "Labels: $labels\n"
while true; do
echo "Options:"
echo " [v] View issue in browser"
echo " [2] Add v2-only label"
echo " [3] Add v3-alpha label"
echo " [b] Add bug label"
echo " [e] Add enhancement label"
echo " [d] Add documentation label"
echo " [w] Add webview2 label"
echo " [f] Request more info (awaiting feedback)"
echo " [c] Close issue (duplicate/invalid)"
echo " [a] Assign to yourself"
echo " [s] Skip to next issue"
echo " [q] Quit script"
read -p "Enter action: " action
case $action in
v)
gh issue view $number --repo wailsapp/wails --web
;;
2)
echo "Adding v2-only label..."
gh issue edit $number --repo wailsapp/wails --add-label "v2-only"
;;
3)
echo "Adding v3-alpha label..."
gh issue edit $number --repo wailsapp/wails --add-label "v3-alpha"
;;
b)
echo "Adding bug label..."
gh issue edit $number --repo wailsapp/wails --add-label "Bug"
;;
e)
echo "Adding enhancement label..."
gh issue edit $number --repo wailsapp/wails --add-label "Enhancement"
;;
d)
echo "Adding documentation label..."
gh issue edit $number --repo wailsapp/wails --add-label "Documentation"
;;
w)
echo "Adding webview2 label..."
gh issue edit $number --repo wailsapp/wails --add-label "webview2"
;;
f)
echo "Requesting more info..."
gh issue comment $number --repo wailsapp/wails --body "Thank you for reporting this issue. Could you please provide additional information to help us investigate?\n\n- [Specific details needed]\n\nThis will help us address your issue more effectively."
gh issue edit $number --repo wailsapp/wails --add-label "awaiting feedback"
;;
c)
read -p "Reason for closing (duplicate/invalid/etc): " reason
gh issue comment $number --repo wailsapp/wails --body "Closing this issue: $reason"
gh issue close $number --repo wailsapp/wails
;;
a)
echo "Assigning to yourself..."
gh issue edit $number --repo wailsapp/wails --add-assignee "$GITHUB_USERNAME"
;;
s)
echo "Skipping to next issue..."
break
;;
q)
echo "Exiting script."
exit 0
;;
*)
echo "Invalid option. Please try again."
;;
esac
echo ""
done
echo -e "--------------------------------\n"
done
echo "No more issues to triage!"

View file

@ -0,0 +1,152 @@
# pr-review-helper.ps1 - Script to help with efficient PR reviews
# Run this during your PR review time
# Set your GitHub username
$GITHUB_USERNAME = "your-username"
# Get open PRs that are ready for review
Write-Host "Fetching PRs ready for review..."
gh pr list --repo wailsapp/wails --json number,title,author,labels,reviewDecision,additions,deletions,baseRefName,headRefName --limit 10 | Out-File -Encoding utf8 -FilePath "prs_temp.json"
$prs = Get-Content -Raw -Path "prs_temp.json" | ConvertFrom-Json
# Process each PR
Write-Host "`n===== PRs Needing Review =====`n"
foreach ($pr in $prs) {
$number = $pr.number
$title = $pr.title
$author = $pr.author.login
$labels = if ($pr.labels) { $pr.labels | ForEach-Object { $_.name } | Join-String -Separator ", " } else { "none" }
$reviewState = if ($pr.reviewDecision) { $pr.reviewDecision } else { "PENDING" }
$baseRef = $pr.baseRefName
$headRef = $pr.headRefName
$changes = $pr.additions + $pr.deletions
Write-Host "PR #$number`: $title"
Write-Host "Author: $author"
Write-Host "Labels: $labels"
Write-Host "Branch: $headRef -> $baseRef"
Write-Host "Changes: +$($pr.additions)/-$($pr.deletions) lines"
Write-Host "Review state: $reviewState`n"
# Determine complexity based on size
$complexity = if ($changes -lt 50) {
"Quick review"
} elseif ($changes -lt 300) {
"Moderate review"
} else {
"Extensive review"
}
Write-Host "Complexity: $complexity"
$continue = $true
while ($continue) {
Write-Host "`nOptions:"
Write-Host " [v] View PR in browser"
Write-Host " [d] View diff in browser"
Write-Host " [c] Generate review checklist"
Write-Host " [a] Approve PR"
Write-Host " [r] Request changes"
Write-Host " [m] Add comment"
Write-Host " [l] Add labels"
Write-Host " [s] Skip to next PR"
Write-Host " [q] Quit script"
$action = Read-Host "Enter action"
switch ($action) {
"v" {
gh pr view $number --repo wailsapp/wails --web
}
"d" {
gh pr diff $number --repo wailsapp/wails --web
}
"c" {
# Generate review checklist
$checklist = @"
## PR Review: $title
### Basic Checks:
- [ ] PR title is descriptive
- [ ] PR description explains the changes
- [ ] Related issues are linked
### Technical Checks:
- [ ] Code follows project style
- [ ] No unnecessary commented code
- [ ] Error handling is appropriate
- [ ] Documentation updated (if needed)
- [ ] Tests included (if needed)
### Impact Assessment:
- [ ] Changes are backward compatible (if applicable)
- [ ] No breaking changes to public APIs
- [ ] Performance impact considered
### Version Specific:
"@
if ($baseRef -eq "master") {
$checklist += @"
- [ ] Appropriate for v2 maintenance
- [ ] No features that should be v3-only
"@
} elseif ($baseRef -eq "v3-alpha") {
$checklist += @"
- [ ] Appropriate for v3 development
- [ ] Aligns with v3 roadmap
"@
}
# Write to clipboard
$checklist | Set-Clipboard
Write-Host "`nReview checklist copied to clipboard!`n"
}
"a" {
$comment = Read-Host "Approval comment (blank for none)"
if ($comment) {
gh pr review $number --repo wailsapp/wails --approve --body $comment
} else {
gh pr review $number --repo wailsapp/wails --approve
}
}
"r" {
$comment = Read-Host "Feedback for changes requested"
gh pr review $number --repo wailsapp/wails --request-changes --body $comment
}
"m" {
$comment = Read-Host "Comment text"
gh pr comment $number --repo wailsapp/wails --body $comment
}
"l" {
$labels = Read-Host "Labels to add (comma-separated)"
$labelArray = $labels -split ","
foreach ($label in $labelArray) {
$labelTrimmed = $label.Trim()
if ($labelTrimmed) {
gh pr edit $number --repo wailsapp/wails --add-label $labelTrimmed
}
}
}
"s" {
Write-Host "Skipping to next PR..."
$continue = $false
}
"q" {
Write-Host "Exiting script."
exit
}
default {
Write-Host "Invalid option. Please try again."
}
}
}
Write-Host "--------------------------------`n"
}
Write-Host "No more PRs to review!"
# Clean up temp file
Remove-Item -Path "prs_temp.json"