File tree Expand file tree Collapse file tree 2 files changed +82
-0
lines changed
Expand file tree Collapse file tree 2 files changed +82
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Script to find TODO/FIXME comments and create GitHub issues
4+ # Usage: ./todo_fixme_to_issues.sh <KEYWORD> <LABEL>
5+ # Example: ./todo_fixme_to_issues.sh TODO enhancement
6+
7+ KEYWORD=$1
8+ LABEL=$2
9+
10+ if [ -z " $KEYWORD " ] || [ -z " $LABEL " ]; then
11+ echo " Usage: $0 <KEYWORD> <LABEL>"
12+ exit 1
13+ fi
14+
15+ # Find all files with the keyword, excluding certain directories
16+ grep -r " $KEYWORD :" --include=" *.py" --include=" *.lua" --include=" *.js" --include=" *.md" | while IFS= read -r line; do
17+ # Extract file, line number, and comment
18+ file=$( echo " $line " | cut -d: -f1)
19+ line_num=$( echo " $line " | cut -d: -f2)
20+ comment=$( echo " $line " | cut -d: -f3- | sed " s/.*$KEYWORD : *//" | sed ' s/^[[:space:]]*//' )
21+
22+ # Skip if comment is empty
23+ if [ -z " $comment " ]; then
24+ continue
25+ fi
26+
27+ # Create issue title and body
28+ title=" [$KEYWORD ] $comment "
29+ body=" Found in \` $file \` at line $line_num :
30+
31+ \`\`\`
32+ $comment
33+ \`\`\`
34+
35+ "
36+
37+ # Check if issue already exists
38+ existing=$( gh issue list --search " $title " --json title --jq ' .[].title' | grep -F " $title " || true)
39+
40+ if [ -z " $existing " ]; then
41+ echo " Creating issue: $title "
42+ gh issue create --title " $title " --body " $body " --label " $LABEL "
43+ else
44+ echo " Issue already exists: $title "
45+ fi
46+ done
Original file line number Diff line number Diff line change 1+ name : " Run TODO to Issue"
2+
3+ on : [push]
4+
5+ permissions :
6+ issues : write
7+ contents : read
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ env :
13+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
14+
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v4
18+
19+ - name : Install GitHub CLI
20+ run : |
21+ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
22+ && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
23+ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
24+ && sudo apt update \
25+ && sudo apt install gh -y
26+
27+ - name : Set script to executable
28+ run : chmod +x .github/scripts/todo_fixme_to_issues.sh
29+
30+ - name : Find TODOs and create issues
31+ run : .github/scripts/todo_fixme_to_issues.sh TODO enhancement
32+
33+ - name : Find BUGs and create issues
34+ run : .github/scripts/todo_fixme_to_issues.sh FIXME bug
35+
36+
You can’t perform that action at this time.
0 commit comments