File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 2929 steps :
3030 - uses : actions/checkout@v3
3131 - name : Check for todos
32+ id : check-todos
3233 run : ./scripts/show-todos.sh
34+ - name : Comment PR
35+ uses : thollander/actions-comment-pull-request@v3
36+ with :
37+ message : ${{ steps.check-todos.outputs.pr-comment }}
38+ comment-tag : execution
Original file line number Diff line number Diff line change @@ -12,6 +12,24 @@ if [ "$LINEAR_ISSUE" = "" ]; then
1212 exit 0
1313fi
1414
15- echo " Searching todos for $LINEAR_ISSUE "
15+ # Locally, simply search and display
16+ if [ " $CI " != " true" ]; then
17+ echo " Searching todos for $LINEAR_ISSUE "
18+ grep " TODO($LINEAR_ISSUE )" . -Rni --color --exclude-dir=" .git"
1619
17- grep " TODO($LINEAR_ISSUE )" . -Rni --color --exclude-dir=" .git"
20+ exit 0
21+ fi
22+
23+ # On the CI
24+ MATCHED_TODOS=$( grep " TODO($LINEAR_ISSUE )" . -Rni --exclude-dir=" .git" )
25+
26+ if [ " $MATCHED_TODOS " = " " ]; then
27+ exit 0
28+ fi
29+
30+ # Annotate files
31+ # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-a-notice-message
32+ echo " $MATCHED_TODOS " | awk -F" :" -v issue=$LINEAR_ISSUE {' print "::notice file="$1",line="$2",title=TODO for "issue"::"$4' }
33+
34+ PR_COMMENT=$( echo " $MATCHED_TODOS " | awk -F" :" -v issue=$LINEAR_ISSUE -v branch=$BRANCH_NAME ' BEGIN{print "Found some TODO annotations for "issue":"} {print "- [ ] ["$4"](../blob/"branch"/"$1":"$2")\\"}' )
35+ echo " pr-comment=$PR_COMMENT " >> " $GITHUB_OUTPUT "
You can’t perform that action at this time.
0 commit comments