name: "Run TODO to Issue"
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "TODO to Issue"
uses: alstr/todo-to-issue-action@v5
with:
INSERT_ISSUE_URLS: "true"
- name: Set Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit and Push Changes
run: |
git add .
git commit -m "Automatically added GitHub issue links to TODOs"
git push origin main
todo-to-issue-action
This action creates, updates, and closes GitHub issues based on TODO comments in your code.
What is todo-to-issue-action?
The todo-to-issue
GitHub Action automatically converts TODO comments in your code into GitHub issues. You can configure it to assign issues, add labels, and link them to milestones and projects.
How to Use file_glob
To use file globbing for uploading multiple files that match a pattern, configure file_glob
in your workflow:
with:
file: target/release/my*
file_glob: true
How to Assign Labels and Assignees to Issues
To assign labels and assignees to the issues created from TODO comments, specify them directly in the TODO comment block:
def hello_world():
# TODO: Improve the greeting
# assignees: alstr, user1
# labels: enhancement, help wanted
print('Hello world!')
How to Insert Issue URLs
You can enable the action to insert issue URLs back into your TODO comments by using INSERT_ISSUE_URLS
:
with:
INSERT_ISSUE_URLS: "true"
This provides better integration between the TODO comments in your code and the GitHub issues created.
How to Close Issues Automatically
To automatically close issues when a TODO is removed from the code, set the CLOSE_ISSUES
input to true
:
with:
CLOSE_ISSUES: "true"
How to Add Issues to Projects
You can add newly created issues to a specified GitHub project by providing a PROJECT
and a PROJECTS_SECRET
:
with:
PROJECT: "user/alstr/test"
PROJECTS_SECRET: "${{ secrets.PROJECTS_SECRET }}"
This works with GitHub v2 projects and requires a Personal Access Token with repo
and project
scopes.
Supported Languages
This action supports many languages, including but not limited to:
- Python
- JavaScript
- TypeScript
- Java
- C++
- PHP
- Ruby
- Swift
You can also add new languages to the action by modifying the syntax.json
file or by using a custom configuration in your workflow.
Example: Assigning Milestones
You can assign a milestone to an issue created from a TODO by adding it to the comment block:
def hello_world():
# TODO: Improve the greeting
# milestone: v3.0
print('Hello world!')
Monitoring GitHub Actions Workflows
CICube is a GitHub Actions monitoring tool that provides you with detailed insights into your workflows to further optimize your CI/CD pipeline. With CICube, you will be able to track your workflow runs, understand where the bottlenecks are, and tease out the best from your build times. Go to cicube.io now and create a free account to better optimize your GitHub Actions workflows!