Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jonabc/sync-task-issues

Sync task issue closure to hierarchical parent tracking issues
https://github.com/jonabc/sync-task-issues

Last synced: about 2 months ago
JSON representation

Sync task issue closure to hierarchical parent tracking issues

Awesome Lists containing this project

README

        

### [DEPRECATED]

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.


javscript-action status

# Mark references to issues and PRs as complete

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

```markdown
- [ ] (url | #number)

becomes

- [x] (url | #number)
```

When an issue or PR which is referenced as a checkbox list item is reopened, the action will mark all references as incomplete.

```markdown
- [x] (url | #number)

becomes

- [ ] (url | #number)
```

## Usage

Create a YAML file in the `.github/workflows` folder of your repository with the following content:

```yml
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 }}
```

## Required permissions

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.

### Inputs

- `github_token`: the token to use for authenticated GitHub API requests
- `state`: explicitly configure whether to mark references as complete or incomplete when the action is triggered
- accepts either `complete` and `incomplete`

### Outputs

- `mark_references_as`: Either `complete` or `incomplete`, showing how references were marked by the action
- `references`: 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](./src/graphql.js) for which data fields are fetched from the API
- `updated`: A list of `${type}:${id}` strings that identify which objects from `references` were updated
- output using `JSON.stringify`, ex. `["Issue:1", "PullRequest:2"]`