Skip to content

Commit ad5b1ce

Browse files
Merge pull request #101 from DiogoRibeiro7/test/todo-action-issue-creation
Test/todo action issue creation
2 parents aa49263 + 4a35713 commit ad5b1ce

Some content is hidden

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

54 files changed

+5388
-620
lines changed

.github/workflows/run_tests.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
22+
- name: Install dependencies
23+
run: yarn install
24+
25+
- name: Run tests with coverage
26+
run: yarn vitest run --coverage
27+
28+
# - name: Upload coverage to Codecov
29+
# uses: codecov/codecov-action@v5
30+
# with:
31+
# files: coverage/coverage-final.json
32+
# token: ${{ secrets.CODECOV_TOKEN }} # optional if public repo

.github/workflows/todo.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Smart TODO Check
1+
name: Smart TODO Tracker
22

33
on:
44
push:
@@ -7,6 +7,10 @@ on:
77
jobs:
88
smart-todo:
99
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
issues: write
13+
1014
steps:
1115
- uses: actions/checkout@v3
1216

@@ -22,3 +26,20 @@ jobs:
2226
uses: ./
2327
with:
2428
repo-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
29+
issue-title-template: src/templates/issueTitle.txt
30+
issue-body-template: src/templates/issueBody.md
31+
report: true
32+
33+
- name: Upload TODO report
34+
uses: actions/upload-artifact@v3
35+
with:
36+
name: todo-report
37+
path: TODO_REPORT.md
38+
39+
- name: Commit TODO report
40+
run: |
41+
git config --global user.name "github-actions[bot]"
42+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
43+
git add TODO_REPORT.md
44+
git commit -m "chore(report): update TODO report" || echo "No changes"
45+
git push
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
🗂 **File:** `{{file}}:{{line}}`
2+
3+
📝 **Content:**
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{{tag}}] {{text}}

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
node_modules/
22
dist/
3-
.env
3+
.env
4+
5+
6+
TODO_REPORT.md

README.md

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,138 @@
1-
# smart-todo-action
1+
# 🧠 smart-todo-action
2+
3+
A GitHub Action that scans your codebase for inline TODOs, FIXMEs, and BUG comments, and automatically creates GitHub Issues — with support for labels, metadata parsing, and semantic enrichment.
4+
5+
---
6+
7+
## 🚀 Features
8+
9+
- ✅ Detects `TODO`, `FIXME`, `BUG`, and `HACK` comments
10+
- ✅ Supports multiple languages: `.ts`, `.js`, `.py`, `.go`, `.html`, etc.
11+
- ✅ Extracts metadata like `priority`, `due`, etc.
12+
- ✅ Automatically labels issues based on type and metadata
13+
- ✅ Creates labels on the fly if they don't exist
14+
15+
---
16+
17+
## ⚙️ Usage
18+
19+
### 1. Add the Action to your workflow
20+
21+
```yaml
22+
name: Smart TODO Tracker
23+
24+
on:
25+
push:
26+
branches: [main]
27+
28+
jobs:
29+
smart-todo:
30+
runs-on: ubuntu-latest
31+
permissions:
32+
issues: write
33+
34+
steps:
35+
- uses: actions/checkout@v3
36+
37+
- name: Setup Node.js
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: 20
41+
42+
- run: yarn install
43+
- run: yarn prepare
44+
45+
- name: Run Smart TODO Action
46+
uses: ./
47+
with:
48+
repo-token: ${{ secrets.GITHUB_TOKEN }}
49+
```
50+
51+
## 📝 Example TODOs
52+
53+
```ts
54+
// TODO(priority=high, due=2025-06-01): Refactor this method for performance
55+
// FIXME: Handle null input properly
56+
// BUG: This causes a crash when file is empty
57+
```
58+
59+
## 🏷️ Automatic Labels
60+
61+
Based on your TODO comment, the following labels will be applied:
62+
63+
| Tag | Label(s) |
64+
|--------|-----------------------------------------------|
65+
| TODO | `enhancement`, `priority:high`, `due:2025-06-01` |
66+
| FIXME | `bug` |
67+
| BUG | `bug` |
68+
| HACK | `technical-debt` |
69+
70+
If a label like `priority:high` or `due:2025-06-01` doesn't exist, it will be automatically created.
71+
72+
---
73+
74+
## 📌 Notes
75+
76+
- Max **5 issues** are created per run to avoid rate limiting
77+
- **Duplicate detection** is not yet implemented _(coming soon)_
78+
- All labels are **auto-created with default colors** if missing
79+
80+
---
81+
82+
## 📤 Coming Soon
83+
84+
- ✅ Issue deduplication
85+
- ✅ Custom templates for issue bodies
86+
- ✅ CLI usage outside GitHub
87+
- ✅ LLM-powered summarization and classification
88+
- ✅ Support for more languages and comment styles
89+
- ✅ Customizable label creation and management
90+
- ✅ Integration with project management tools (e.g., Jira, Trello)
91+
- ✅ Support for multiple repositories in a single run
92+
- ✅ Rate limiting and error handling improvements
93+
- ✅ Customizable issue creation frequency (e.g., daily, weekly)
94+
- ✅ Support for user-defined metadata tags
95+
- ✅ Customizable issue assignment (e.g., to specific users or teams)
96+
- ✅ Support for issue templates and custom fields
97+
- ✅ Integration with CI/CD pipelines for automated issue tracking
98+
- ✅ Support for issue comments and discussions
99+
- ✅ Customizable notification settings (e.g., email, Slack)
100+
- ✅ Support for issue closing and resolution tracking
101+
- ✅ Customizable issue lifecycle management (e.g., open, in progress, closed)
102+
103+
104+
```plaintext
105+
smart-todo-action/
106+
├── .github/
107+
│ └── workflows/
108+
│ └── todo.yml
109+
110+
├── dist/
111+
│ └── index.js
112+
113+
├── src/
114+
│ ├── core/
115+
│ │ ├── issueManager.ts
116+
│ │ ├── labelManager.ts # 🆕 Label logic (static + metadata + creation)
117+
│ │ ├── report.ts
118+
│ │ ├── todoUtils.ts
119+
│ │ └── __tests__/ # (opcional) unit tests
120+
121+
│ ├── parser/
122+
│ │ ├── extractTodosFromDir.ts
123+
│ │ ├── extractTodosFromFile.ts
124+
│ │ └── types.ts
125+
126+
│ ├── templates/
127+
│ │ ├── issueTitle.txt
128+
│ │ ├── issueBody.md
129+
│ │ └── utils.ts
130+
131+
│ └── ActionMain.ts
132+
133+
├── .gitignore
134+
├── action.yml
135+
├── package.json
136+
├── tsconfig.json
137+
└── README.md
138+
```

ROADMAP.md

Lines changed: 3 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ A smart GitHub Action that detects, classifies, and transforms inline TODOs in y
4444

4545
> Provide visibility into the evolution and structure of tracked TODOs.
4646
47-
- [ ] Markdown/HTML dashboard with summary statistics
48-
_Total TODOs, grouped by folder, priority, author (`git blame`)_
47+
- [X] Markdown/HTML dashboard with summary statistics
48+
_Total TODOs, grouped by folder, priority, author (`git blame`) — **now sorted by `priority` and `due` date**_
49+
4950
- [ ] TODO history tracking (added/removed/modified)
5051
- [ ] Due date notifications or PR comments
5152

@@ -68,101 +69,3 @@ A smart GitHub Action that detects, classifies, and transforms inline TODOs in y
6869
- Clean architecture and modularity are core principles from day one.
6970
- LLM functionality will be optional and clearly separated from core logic.
7071
- Built with automation, extensibility, and developer workflows in mind.
71-
72-
---
73-
74-
# 🚀 Roadmap for TODO Issue Tracker 2.0
75-
76-
This project aims to build an intelligent GitHub Action that scans your codebase for TODOs, classifies them, and transforms them into contextualized GitHub Issues — with semantic analysis and multi-platform integration.
77-
78-
---
79-
80-
## 🧱 Phase 1: Foundations and Parity with the Original Project
81-
82-
🎯 Goal: Recreate the original functionality with clean, modular, and testable code.
83-
84-
- [ ] Create the base project structure
85-
- `src/` folder for source code
86-
- Subfolders: `core/`, `parser/`, `tasks/`, `templates/`, etc.
87-
88-
- [ ] Implement TODO parser
89-
- Detect `TODO`, `FIXME`, `BUG`, etc. comments
90-
- Support for multiple languages (`.js`, `.ts`, `.py`, `.go`, etc.)
91-
92-
- [ ] Initial task system: GitHub Issues
93-
- Create, update, and remove issues based on detected TODOs
94-
95-
- [ ] Templating system for issue creation
96-
- Customizable titles and descriptions via templates
97-
98-
- [ ] Functional GitHub Action workflow
99-
- `action.yml` definition file
100-
- Example usage in `.github/workflows/todo.yml`
101-
102-
- [ ] Unit testing with Jest or Vitest
103-
104-
---
105-
106-
## 🧠 Phase 2: Intelligence and Semantics
107-
108-
🎯 Goal: Make the system smarter by leveraging LLMs and contextual awareness.
109-
110-
- [ ] Automatic TODO classification
111-
- Use LLMs or heuristics to classify as `bug`, `enhancement`, `refactor`, etc.
112-
113-
- [ ] Auto-generate issue titles and descriptions using LLMs
114-
_Example: `Review sorting algorithm``Optimize Sorting Algorithm for Edge Cases`_
115-
116-
- [ ] Extract `due date` and `priority` via inline metadata parsing
117-
_Example: `TODO(priority=high, due=2025-06-01): improve this logic`_
118-
119-
---
120-
121-
## 🌍 Phase 3: Extended Support
122-
123-
🎯 Goal: Make the project adaptable to diverse environments and workflows.
124-
125-
- [ ] Support for multiple task management platforms
126-
_GitHub, Jira, Notion, Trello, Linear (via APIs)_
127-
128-
- [ ] Internationalization (i18n)
129-
_Detect TODOs written in different languages_
130-
131-
- [ ] Support for additional file types
132-
_`.ipynb`, `.yaml`, `.md`, `.json`, `.xml`, and more_
133-
134-
---
135-
136-
## 📊 Phase 4: Analysis and Reporting
137-
138-
🎯 Goal: Provide visibility into the state and evolution of TODOs.
139-
140-
- [ ] Markdown/HTML dashboard with metrics
141-
_Total TODOs, grouped by folder, priority, author (`git blame`)_
142-
143-
- [ ] TODO history tracking
144-
_Track when TODOs are added, removed, or changed over time_
145-
146-
- [ ] Notifications and reminders
147-
_Comment on PRs or issues when due dates are approaching_
148-
149-
---
150-
151-
## 🔁 Phase 5: Optimizations and Contributions
152-
153-
🎯 Goal: Ensure quality, performance, and ease of collaboration.
154-
155-
- [ ] Plugin-based modular architecture
156-
- [ ] CLI support (standalone usage outside GitHub Actions)
157-
- [ ] Test coverage >90%
158-
- [ ] Full documentation with usage examples
159-
- [ ] Publish to GitHub Marketplace as an official Action
160-
161-
---
162-
163-
## 📌 Notes
164-
165-
- Modularity, testability, and code clarity are priorities from day one.
166-
- LLM integration will be optional and cleanly decoupled from core logic.
167-
- Designed with automation, extensibility, and developer experience in mind.
168-

action.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@ author: 'Diogo Ribeiro'
44

55
inputs:
66
repo-token:
7-
description: 'GitHub token com permissão para criar issues'
87
required: true
8+
description: GitHub token to create issues
9+
10+
report:
11+
required: false
12+
description: Whether to generate a TODO markdown report
13+
default: 'false'
14+
15+
issue-title-template:
16+
required: false
17+
description: Optional path to custom issue title template
18+
19+
issue-body-template:
20+
required: false
21+
description: Optional path to custom issue body template
922

1023
runs:
1124
using: 'node20'
@@ -14,3 +27,4 @@ runs:
1427
branding:
1528
icon: 'check-circle'
1629
color: 'blue'
30+

0 commit comments

Comments
 (0)