https://github.com/rebeccastevens/issue-closed-labeler-action
Conditionally add or remove labels of issues when closed via a PR.
https://github.com/rebeccastevens/issue-closed-labeler-action
Last synced: 5 months ago
JSON representation
Conditionally add or remove labels of issues when closed via a PR.
- Host: GitHub
- URL: https://github.com/rebeccastevens/issue-closed-labeler-action
- Owner: RebeccaStevens
- License: bsd-3-clause
- Created: 2022-01-24T12:01:55.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-04T01:37:28.000Z (8 months ago)
- Last Synced: 2024-10-14T13:05:01.390Z (8 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.1 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 77
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Issue Closed Labeler (GitHub Action)
Conditionally add or remove labels of issues when closed via a PR.
[](https://github.com/RebeccaStevens/issue-closed-labeler-action/actions/workflows/ci.yml)
[](https://codecov.io/gh/RebeccaStevens/issue-closed-labeler-action)
[](https://github.com/prettier/prettier)
[](https://github.com/RebeccaStevens/issue-closed-labeler-action/discussions)
[](https://opensource.org/licenses/BSD-3-Clause)
[](https://commitizen.github.io/cz-cli/)
[](https://github.com/semantic-release/semantic-release)## Inputs
### `rules`
A JSON encoded array of conditions that need to be met and what should happen when they are.
Examples of unencoded rules.
```js,
[
{
// Only apply this rule if the issue already has the "bug" label.
condition: "bug",
add: "fixed", // Add the "fixed" label.
},
{
condition: "bug",
add: [
"fixed", // Add the "fixed" label.
"merged", // Also add the "merged" label.
],
remove: "wip" // Remove the "wip" label if present.
},
{
// Only apply this rule if the issue already has either the "feature" or "enhancement" label.
condition: [
"some", // Other options include "all" and "none".
["feature", "enhancement"]
],
add: "added", // Add the "added" label.
},
{
// Same as the rule above but the labels must be on the PR itself.
condition: [
"pull request", // The other option is "issue" which is the default.
"some",
["feature", "enhancement"]
],
add: "added", // Add the "added" label.
},
{
// More complex conditions can be built up using operators.
// Only apply this rule if the issue already has the "bug" label and does not have the "do not merge" label.
condition: [
[
"all",
["bug"]
],
"and", // Other options include "or" and brackets "(", ")". You can also use "&&" and "||" if you prefer.
[
"none",
["do not merge"]
],
],
add: "fix",
}
]
```### `token`
A github token used for creating an octoclient for making API calls. **Default: `${{ github.token }}`**.
## Debug Logging
This action supports [debug logging](https://docs.github.com/en/actions/managing-workflow-runs/enabling-debug-logging#enabling-step-debug-logging). When enabled, it will dump the output of the
api call for creating the tags/branches.
This is useful for testing and should be included when reporting bugs.# Sample Usage
`versioning.yml`
```yaml
name: PR close - update issueson:
pull_request:
types:
- closedjobs:
run:
name: "Test"
runs-on: ubuntu-latest
steps:
- name: Update Labels
uses: RebeccaStevens/issue-closed-labeler-action@latest
with:
rules: '[{"condition": "Type: Bug", "add": "Resolution: Fixed"}]'
```