This GitHub Action scans your code for Todos, adds review comments, and creates a commit status based on the discovered Todos. It offers an effective means to stay organized and track tasks that require attention within your codebase.
To use this action in your workflow, add the following step. By default, the
action will search for //
, *
and #
followed by TODO
or FIXME
.
name: PR Todo Checker
on:
pull_request_review_comment:
types: [edited, deleted]
pull_request:
types: [opened, synchronize, reopened]
jobs:
find_todos:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for Todos
uses: phntmxyz/pr_todo_checker@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
Example of matching Todos:
// TODO - upper case with much space
// todo - lower case with space
//todo - lower case no space
/ no comment
// also todo comment
// fixme found todo
/*
* todo - In comment block
*/
# TODO with hashtag comment
# FIXME with hashtag comment
You can configure the action further by providing inputs:
token
: The GitHub token to use for commenting on the PR. This is required.exclude
: (optional) A list of glob patterns to exclude from the search.comment_on_todo
: (optional) Whether to comment on the PR with the TODOs found. Default istrue
.comment_body
: (optional) The body of the comment to post on the PR. Use{todo}
to insert the Todo content.comment_checkbox
: (optional) The text to use for the checkbox in the comment. Use{todo}
to insert the Todo contentcustom_todo_matcher
: (optional) Add custom comment indicators to match TODOs. Default matches//
,*
and#
followed byTODO
orFIXME
.custom_ignore_matcher
: (optional) Add custom regex to ignore TODOs that match in the same line. Example: Settingcustom_ignore_matcher: "/.*ignore.*/"
will ignore TODOs like// TODO ignore
.
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for Todos
uses: phntmxyz/pr_todo_checker@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
exclude: |
*.md
**/config/*.yml
comment_on_todo: true
comment_body: |
"A new Todo was discovered. If it is not a priority right now,\
consider marking it for later attention.\n{todo}\n"
comment_checkbox: 'Ignore'
custom_todo_matcher: "{'js': ['//', '/*'], 'py': ['#']}"