From d8aa29a05e0bc366f9293d195135ecf94c1954f1 Mon Sep 17 00:00:00 2001 From: Dunsin <78784850+Dun-sin@users.noreply.github.com> Date: Fri, 22 Nov 2024 18:05:43 +0100 Subject: [PATCH] docs: create GitHub action for automating labels (#725) --- .github/workflows/issue-assignment-labelling | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/issue-assignment-labelling diff --git a/.github/workflows/issue-assignment-labelling b/.github/workflows/issue-assignment-labelling new file mode 100644 index 00000000..e11fda97 --- /dev/null +++ b/.github/workflows/issue-assignment-labelling @@ -0,0 +1,30 @@ +name: Manage Issue Assignment Labels + +on: + issues: + types: [assigned, unassigned] + +jobs: + manage-labels: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Manage issue labels based on assignment + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + run: | + # Issue is being assigned + if [[ "${{ github.event.action }}" == "assigned" ]]; then + echo "Issue is being assigned" + gh issue edit "$NUMBER" --add-label "assigned" + gh issue edit "$NUMBER" --remove-label "up for grabs" + + # Issue is being unassigned + elif [[ "${{ github.event.action }}" == "unassigned" ]]; then + echo "Issue is being unassigned" + gh issue edit "$NUMBER" --remove-label "assigned" + gh issue edit "$NUMBER" --add-label "up for grabs" + fi