https://github.com/urcomputeringpal/add-remove-labels-action
A GitHub Actions that adds/removes labels to/from Issues/PRs
https://github.com/urcomputeringpal/add-remove-labels-action
Last synced: 9 months ago
JSON representation
A GitHub Actions that adds/removes labels to/from Issues/PRs
- Host: GitHub
- URL: https://github.com/urcomputeringpal/add-remove-labels-action
- Owner: urcomputeringpal
- License: apache-2.0
- Created: 2020-05-01T13:38:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-07T18:55:11.000Z (over 5 years ago)
- Last Synced: 2023-03-02T16:25:39.952Z (over 2 years ago)
- Language: Go
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Add/remove labels GitHub action
A tiny GitHub action that can add labels to pull requests and remove them from issues (and vice versa). Packaged as a tiny Golang binary in a Docker image for maximum performance.
## Usage
Use `urcomputeringpal/add-remove-labels-action` as a step in your workflow that processes `issues` and/or `pull_request` events.
Add labels:
```yaml
- name: add-labels
uses: urcomputeringpal/add-remove-labels-action@master
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
action: add
labels: feature
```
Or remove them:
```yaml
- name: add-labels
uses: urcomputeringpal/add-remove-labels-action@master
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
action: remove
labels: bug
```
## Advanced Usage
This action pairs nicely with GitHub Actions' support for conditionally executing steps. In the following example, a label is added to or removed from a pull request based on the exit status of a theoretical `diff` utility.
```yaml
strategy:
fail-fast: false
matrix:
component:
- app
- assets
- admin
steps:
# ...
- name: diff
id: diff
run: |
if ./pseudocode-diff-tool; then
echo "::set-output name=changes::true"
else
echo "::set-output name=changes::false"
fi
- name: add-labels
uses: urcomputeringpal/add-remove-labels-action@master
if: "steps.diff.outputs.changes == 'true'"
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
action: add
labels: "changes ${{ matrix.component }}"
- name: remove-labels
uses: urcomputeringpal/add-remove-labels-action@master
if: "steps.diff.outputs.changes != 'true'"
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
action: remove
labels: "changes ${{ matrix.component }}"
```