GitHub action to copy labels from any issues closed by a pull request into the pull request itself
---
name: Sync Closing Labels
on:
- pull_request_target
jobs:
sync:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Sync labels with closing issues
uses: williambdean/[email protected]
env:
GH_TOKEN: ${{ github.token }}Please see our Security Policy for information on how to report security vulnerabilities.
exclude: A comma separated list of labels to exclude from the closing labels. Default:""- Example:
exclude: "wontfix,good first issue"will not addwontfixandgood first issuelabels to the pull request from the closing issues.
- Example:
respect_unlabeled: Respect theunlabeledevent. Default:true. Set tofalsewill relabel the pull request with the all closing labels.
Add various configuration in the with section of the action:
with:
exclude: "wontfix,good first issue"
respect_unlabeled: falseBuild and enter Docker container used in the action locally:
make build
make interactive
Use a different version of gh CLI, you can pass the version to make build like so:
GH_VERSION=2.81.0 make build
From inside the container, run the action script with the required environment variables:
INPUT_OWNER="williambdean" \
INPUT_REPO="closing-labels" \
INPUT_PR_NUMBER="21" \
INPUT_EXCLUDE="wontfix,duplicate" \
INPUT_RESPECT_UNLABELED="true" \
INPUT_DRY_RUN="true" \
./entrypoint.shThis command sets the necessary environment variables with example values and
then executes the script. You would need to have gh (the GitHub CLI) and jq
installed and authenticated to run it successfully outside of the container.
The container provided via the Makefile has these dependencies installed.
