Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peter-evans/close-issue
A GitHub action to close an issue
https://github.com/peter-evans/close-issue
automation close-issue github-action github-issues workflow
Last synced: 14 days ago
JSON representation
A GitHub action to close an issue
- Host: GitHub
- URL: https://github.com/peter-evans/close-issue
- Owner: peter-evans
- License: mit
- Created: 2020-05-04T03:00:58.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-01-31T11:51:13.000Z (about 1 year ago)
- Last Synced: 2024-10-14T19:32:13.207Z (4 months ago)
- Topics: automation, close-issue, github-action, github-issues, workflow
- Homepage:
- Size: 1.33 MB
- Stars: 27
- Watchers: 4
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Close Issue
[](https://github.com/peter-evans/close-issue/actions?query=workflow%3ACI)
[](https://github.com/marketplace/actions/close-issue)A GitHub action to close an issue.
## Usage
| :exclamation: Using this action is no longer necessary |
|-----------------------------------------------------------|The same functionality exists in the GitHub CLI. See the documentation [here](https://cli.github.com/manual/gh_issue_close).
```yml
- name: Close Issue
run: gh issue close --comment "Auto-closing issue" "1"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```If you prefer to use this action:
```yml
- name: Close Issue
uses: peter-evans/close-issue@v3
with:
issue-number: 1
comment: Auto-closing issue
```### Close issues where the title does not match a specified prefix
This is just an example to show one way in which this action can be used.
```yml
on:
issues:
types: [opened]
jobs:
titlePrefixCheck:
runs-on: ubuntu-latest
steps:
- if: startsWith(github.event.issue.title, 'ABC-') != 'true'
name: Close Issue
uses: peter-evans/close-issue@v3
with:
comment: |
Issue title must start with 'ABC-'.
Auto-closing this issue.
```### Close issue and add label(s)
```yml
- name: Close Issue
uses: peter-evans/close-issue@v3
with:
issue-number: 1
comment: Auto-closing issue
labels: |
wontfix
```### Action inputs
| Name | Description | Default |
| --- | --- | --- |
| `token` | `GITHUB_TOKEN` or a `repo` scoped [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` |
| `repository` | The GitHub repository containing the issue. | Current repository |
| `issue-number` | The number of the issue to close. | `github.event.issue.number` |
| `close-reason` | Reason for closing the issue; `completed` or `not_planned`. | `completed` |
| `comment` | A comment to make on the issue before closing. | |
| `labels` | A comma or newline separated list of labels. | |### Accessing issues in other repositories
You can close issues in another repository by using a [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) instead of `GITHUB_TOKEN`.
The user associated with the PAT must have write access to the repository.## License
[MIT](LICENSE)