GitHub's native markdown task lists were updated since this action was originally created to perform the same behaviors. This action has been deprecated and will not receive any future changes.
This GH Action finds checkbox list item cross-references to an issue or pull request from an event and marks the references as complete.
This action uses the GitHub GraphQL API to find references, and updates each reference's body. The action looks for checkbox list items that are unchecked and marks them completed
- [ ] <any text>(url | #number)<any text>
becomes
- [x] <any text>(url | #number)<any text>
When an issue or PR which is referenced as a checkbox list item is reopened, the action will mark all references as incomplete.
- [x] <any text>(url | #number)<any text>
becomes
- [ ] <any text>(url | #number)<any text>
Create a YAML file in the .github/workflows
folder of your repository with the following content:
name: Cross off linked issues
on:
# the closed event type causes unchecked checkbox references to be checked / marked complete
# the reopened event type causes checked checkbox references to be unchecked / marked incomplete
issues:
types: [closed, reopened]
# the action works on pull request events as well
pull_request:
types: [closed, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cross off any linked issue and PR references
uses: jonabc/sync-task-issues@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
The default ${{ secrets.GITHUB_TOKEN }} token can be used only when both the closed issues or PRs and their references are in the same repo.
For cross-repo references, a personal access token with repo
access is needed from a user account that can write
to the all repositories containing references.
github_token
: the token to use for authenticated GitHub API requestsstate
: explicitly configure whether to mark references as complete or incomplete when the action is triggered- accepts either
complete
andincomplete
- accepts either
mark_references_as
: Eithercomplete
orincomplete
, showing how references were marked by the actionreferences
: The list of objects obtained from the GitHub API that referenced the current issue or PR- output using
JSON.stringify
, ex.[{ ... reference 1 }, { ... reference 2 }]
- see graphql.js#fields for which data fields are fetched from the API
- output using
updated
: A list of${type}:${id}
strings that identify which objects fromreferences
were updated- output using
JSON.stringify
, ex.["Issue:1", "PullRequest:2"]
- output using