Skip to content

Commit cc7d6a2

Browse files
Merge pull request #105 from DiogoRibeiro7/chore/restart
Chore/restart
2 parents 6411cc4 + 5cd3abd commit cc7d6a2

File tree

83 files changed

+47824
-66
lines changed

Some content is hidden

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

83 files changed

+47824
-66
lines changed

.github/workflows/todo.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
issue-title-template: src/templates/issueTitle.txt
3030
issue-body-template: src/templates/issueBody.md
3131
report: true
32+
llm: true
33+
env:
34+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3235

3336
- name: Upload TODO report
3437
uses: actions/upload-artifact@v4
@@ -46,5 +49,4 @@ jobs:
4649
git add TODO_REPORT.md CHANGELOG.md
4750
git diff --cached --quiet && echo "No changes to commit." || git commit -m "chore(report): update TODO report and changelog [skip ci]"
4851
git push
49-
5052

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
node_modules/
2-
dist/
2+
# dist/
33
.env
4-
5-
6-
TODO_REPORT.md

action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,19 @@ inputs:
2020
required: false
2121
description: Optional path to custom issue body template
2222

23+
llm:
24+
required: false
25+
description: Use LLM to generate issue titles and bodies
26+
default: 'false'
27+
28+
openai-api-key:
29+
required: false
30+
description: OpenAI API key used when `llm` is true
31+
2332
runs:
2433
using: 'node20'
2534
main: 'dist/index.js'
2635

2736
branding:
2837
icon: 'check-circle'
2938
color: 'blue'
30-

dist/ActionMain.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

dist/ActionMain.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || (function () {
19+
var ownKeys = function(o) {
20+
ownKeys = Object.getOwnPropertyNames || function (o) {
21+
var ar = [];
22+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23+
return ar;
24+
};
25+
return ownKeys(o);
26+
};
27+
return function (mod) {
28+
if (mod && mod.__esModule) return mod;
29+
var result = {};
30+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31+
__setModuleDefault(result, mod);
32+
return result;
33+
};
34+
})();
35+
Object.defineProperty(exports, "__esModule", { value: true });
36+
const core = __importStar(require("@actions/core"));
37+
const github = __importStar(require("@actions/github"));
38+
const extractTodosFromDir_1 = require("./parser/extractTodosFromDir");
39+
const issueManager_1 = require("./core/issueManager");
40+
const report_1 = require("./core/report");
41+
const todoUtils_1 = require("./core/todoUtils");
42+
async function run() {
43+
try {
44+
const token = core.getInput('repo-token', { required: true });
45+
const generateReport = core.getInput('report') === 'true';
46+
const titleTemplatePath = core.getInput('issue-title-template');
47+
const bodyTemplatePath = core.getInput('issue-body-template');
48+
const workspace = process.env.GITHUB_WORKSPACE || '.';
49+
const todos = (0, extractTodosFromDir_1.extractTodosFromDir)(workspace);
50+
const octokit = github.getOctokit(token);
51+
const { owner, repo } = github.context.repo;
52+
core.info(`🔍 Found ${todos.length} TODOs`);
53+
const existingTitles = await (0, issueManager_1.getExistingIssueTitles)(octokit, owner, repo);
54+
const seenKeys = new Set();
55+
const uniqueTodos = todos.filter(todo => {
56+
const key = (0, todoUtils_1.todoKey)(todo);
57+
if (seenKeys.has(key))
58+
return false;
59+
seenKeys.add(key);
60+
return true;
61+
});
62+
const todosToCreate = (0, todoUtils_1.limitTodos)(uniqueTodos, 5);
63+
for (const todo of todosToCreate) {
64+
await (0, issueManager_1.createIssueIfNeeded)(octokit, owner, repo, todo, existingTitles, titleTemplatePath, bodyTemplatePath);
65+
}
66+
if (generateReport) {
67+
(0, report_1.generateMarkdownReport)(todos);
68+
core.info('📝 Generated TODO_REPORT.md');
69+
}
70+
}
71+
catch (error) {
72+
core.setFailed(`Action failed: ${error.message}`);
73+
}
74+
}
75+
run();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

0 commit comments

Comments
 (0)