-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-workflow.yml
More file actions
57 lines (49 loc) · 2.18 KB
/
example-workflow.yml
File metadata and controls
57 lines (49 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Example TODO Check
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
check-todos:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Scan for TODOs
id: todo-scan
uses: Gustrb/todo-creeper@v1.1.0
with:
threshold: 5
exclude-patterns: 'node_modules,dist,build,.git,tests/mocks'
create-issues: true
issue-labels: 'todo,enhancement,needs-review'
- name: Create TODO Report
if: steps.todo-scan.outputs.todo-count != '0'
run: |
echo "## 📋 TODO Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Total TODOs found:** ${{ steps.todo-scan.outputs.todo-count }}" >> $GITHUB_STEP_SUMMARY
echo "**Files affected:** ${{ steps.todo-scan.outputs.todo-files }}" >> $GITHUB_STEP_SUMMARY
echo "**New issues created:** ${{ steps.todo-scan.outputs.issues-created }}" >> $GITHUB_STEP_SUMMARY
echo "**Existing issues linked:** ${{ steps.todo-scan.outputs.issues-linked }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### TODO Details:" >> $GITHUB_STEP_SUMMARY
echo '```json' >> $GITHUB_STEP_SUMMARY
echo '${{ steps.todo-scan.outputs.todo-details }}' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Comment on PR
if: github.event_name == 'pull_request' && steps.todo-scan.outputs.todo-count != '0'
uses: actions/github-script@v7
with:
script: |
const todoCount = '${{ steps.todo-scan.outputs.todo-count }}';
const todoFiles = '${{ steps.todo-scan.outputs.todo-files }}';
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🔍 **TODO Creeper Report**
Found **${todoCount} TODOs** across **${todoFiles} files**.
Consider addressing these TODOs to improve code quality!`
});