From cf925c9e3c6051ae9c38c600bf5f54e57a84d6cd Mon Sep 17 00:00:00 2001 From: Lorenzo Manacorda Date: Mon, 28 Oct 2024 17:44:23 +0100 Subject: [PATCH] ci: update labels on merged PRs --- .github/workflows/update-pr-labels.yml | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/update-pr-labels.yml diff --git a/.github/workflows/update-pr-labels.yml b/.github/workflows/update-pr-labels.yml new file mode 100644 index 0000000..eae7bf9 --- /dev/null +++ b/.github/workflows/update-pr-labels.yml @@ -0,0 +1,29 @@ +name: Update PR labels + +on: + pull_request: + types: [closed] + +jobs: + after-merge: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + permissions: + pull-requests: write + + steps: + - uses: cachix/install-nix-action@v30 + + - run: nix-env -iA nixpkgs.github-cli + + - name: Update PR Labels + env: + GH_TOKEN: ${{ github.token }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.repository }} + run: | + # Remove `status: accepted` label, if present + gh pr edit $PR_NUMBER --remove-label "status: accepted" --repo $REPO || true + + # Add `status: merged` label + gh pr edit $PR_NUMBER --add-label "status: merged" --repo $REPO