-
-
Notifications
You must be signed in to change notification settings - Fork 18
42 lines (34 loc) · 1.11 KB
/
todo-comments.yml
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
name: Check TODO Comments
on:
pull_request:
jobs:
find-todo-comments:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: yuto-trd/todo-comments-in-pr@v1
id: todos
- name: Generate a summary of the tasks
uses: actions/github-script@v7
id: summary
with:
result-encoding: string
script: |
const tasks = JSON.parse(String.raw`${{ steps.todos.outputs.tasks }}`);
let body = tasks.map(task => `https://github.com/${{ github.repository }}/blob/${{ github.sha }}/${task.fileName}#L${task.startLine}-L${task.endLine}`).join('\n');
if (tasks.length > 0) {
body = `The following TODO comments were found:\n\n${body}`;
} else {
body = 'No TODO comments were found.';
}
return body;
- name: Comment on the pull request
uses: marocchino/sticky-pull-request-comment@v2
with:
header: todo-cooments
recreate: true
message: |
${{ steps.summary.outputs.result }}