Automatically track TODOs in your code and create GitHub issues for them. When you push commits with new TODOs, issues are created. When TODOs are removed, issues are closed. Issue URLs are automatically inserted back into your code.
This is a reusable workflow that can be easily integrated into any repository.
- Automatically creates GitHub issues for TODOs in your code
- Closes issues when TODOs are removed
- Auto-assigns issues to the TODO author
- Inserts issue URLs back into the code comments
- Configurable per repository
- Supports multiple branches (main, dev, etc.)
- Manual initialization for existing TODOs
You need a GitHub App to authenticate the workflow with elevated permissions.
- Go to GitHub Settings → Developer settings → GitHub Apps → New GitHub App
- Configure the app:
- Name:
TODO Tracker(or any name you prefer) - Homepage URL: Your organization or personal website
- Webhook: Uncheck "Active"
- Permissions:
- Repository permissions:
- Contents: Read and write
- Issues: Read and write
- Pull requests: Read and write
- Repository permissions:
- Where can this GitHub App be installed?: Only on this account
- Name:
- Create the app
- Generate a private key (click "Generate a private key" at the bottom)
- Note the App ID (shown at the top of the app page)
- Install the app on your organization or repositories
In each repository where you want to use TODO tracking:
- Go to Settings → Secrets and variables → Actions
- Add two secrets:
TODO_APP_ID: Your GitHub App IDTODO_APP_PRIV_KEY: Your GitHub App private key (entire contents of the .pem file)
If your repository uses branch protection rules:
- Go to Settings → Branches → Branch protection rules
- Edit your branch protection rule (e.g., for
mainordev) - Scroll to "Rules applied to everyone including administrators"
- Under "Allow specified actors to bypass required pull requests", add your GitHub App
- Check "Exempt" next to your TODO Tracker app
This allows the workflow to automatically merge the PR that adds issue links back to your code.
Copy .github/workflows/todo-tracking-example.yml to your repository as
.github/workflows/todo-tracking.yml:
name: Track TODOs
on:
push:
branches:
- main
- dev
workflow_dispatch:
inputs:
MANUAL_COMMIT_REF:
description: "The SHA of the commit to get the diff for"
required: true
MANUAL_BASE_REF:
description: "By default, the commit entered above is compared to the one directly before it; to go back further, enter an earlier SHA here"
required: false
jobs:
track:
permissions:
contents: write
issues: write
pull-requests: write
uses: JHOFER-Cloud/todo-tracking/.github/workflows/todo-tracking-reusable.yml@main
with:
manual_commit_ref: ${{ inputs.MANUAL_COMMIT_REF }}
manual_base_ref: ${{ inputs.MANUAL_BASE_REF }}
secrets:
TODO_APP_ID: ${{ secrets.TODO_APP_ID }}
TODO_APP_PRIV_KEY: ${{ secrets.TODO_APP_PRIV_KEY }}If you need to track TODOs in file types not supported by default:
- Copy
.github/workflows/syntax.jsonfrom this repo to your repository - Customize it to add your file types
- Update the workflow to use it:
jobs:
track:
permissions:
contents: write
issues: write
pull-requests: write
uses: JHOFER-Cloud/todo-tracking/.github/workflows/todo-tracking-reusable.yml@main
with:
languages: ".github/workflows/syntax.json" # Add this line
manual_commit_ref: ${{ inputs.MANUAL_COMMIT_REF }}
manual_base_ref: ${{ inputs.MANUAL_BASE_REF }}
secrets:
TODO_APP_ID: ${{ secrets.TODO_APP_ID }}
TODO_APP_PRIV_KEY: ${{ secrets.TODO_APP_PRIV_KEY }}For repositories with existing TODOs, you need to initialize them by running the workflow manually:
- Go to Actions → Track TODOs → Run workflow
- Fill in:
- MANUAL_COMMIT_REF: Current commit SHA (HEAD)
- MANUAL_BASE_REF: First commit in the repository (or earliest commit you want to track from)
- Click "Run workflow"
To find the first commit SHA:
git log --reverse --oneline | head -1This will scan all TODOs between the first commit and HEAD, creating issues for all of them.
Add TODOs in your code with standard comment syntax:
// TODO: Implement user authentication
// TODO(username): Add error handling here# TODO: Optimize this query
# TODO(username): Add input validation// TODO: Refactor this function
/* TODO: Add comprehensive tests */-
On push to tracked branches (main, dev):
- Workflow scans the diff for new or removed TODOs
- Creates issues for new TODOs
- Closes issues for removed TODOs
- Inserts issue URLs back into the code (e.g.,
// TODO: Fix bug https://github.com/org/repo/issues/123) - Creates a PR with the issue links and auto-merges it back to the branch that triggered the workflow
-
The TODO comment is updated:
// TODO: Implement user authentication https://github.com/org/repo/issues/42 -
Issues are automatically managed:
- Created when TODO is added
- Closed when TODO is removed
- Assigned to the commit author
You can customize the workflow behavior by adding with parameters:
jobs:
track:
permissions:
contents: write
issues: write
pull-requests: write
uses: JHOFER-Cloud/todo-tracking/.github/workflows/todo-tracking-reusable.yml@main
with:
# Close issues when TODOs are removed (default: true)
close_issues: true
# Auto-assign issues to TODO author (default: true)
auto_assign: true
# Insert issue URLs back into code (default: true)
insert_issue_urls: true
# Path to custom syntax.json file (default: '.github/workflows/syntax.json')
languages: ".github/workflows/custom-syntax.json"
# For workflow_dispatch initialization
manual_commit_ref: ${{ inputs.MANUAL_COMMIT_REF }}
manual_base_ref: ${{ inputs.MANUAL_BASE_REF }}
secrets:
TODO_APP_ID: ${{ secrets.TODO_APP_ID }}
TODO_APP_PRIV_KEY: ${{ secrets.TODO_APP_PRIV_KEY }}The default configuration supports these file types:
- Shell scripts (
.sh,.fish) - Configuration files (
.conf,.env,.gitignore) - Build files (
justfile) - Nix (
.nix) - Docker (
Dockerfile) - YAML (
.yaml,.yml) - TOML (
.toml)
Standard languages (JavaScript, Python, Go, etc.) are supported by default through the TODO to Issue Action.
Make sure:
- This repository (
JHOFER-Cloud/todo-tracking) is public, OR - Your calling repository is in the same organization
Check:
- GitHub App is installed on the repository
- Secrets
TODO_APP_IDandTODO_APP_PRIV_KEYare set correctly - GitHub App has correct permissions (Contents, Issues, Pull requests)
Check:
- GitHub App is added to branch protection bypass rules
- App is marked as "Exempt"
- Branch protection settings allow force pushes from the app
Add your file type to .github/workflows/syntax.json and configure the
languages input in your workflow.
See the .github/workflows/todo-tracking-example.yml file for a complete
example.
This workflow uses:
- TODO to Issue Action by @alstr
- create-github-app-token by GitHub
MIT