From a9afb898d9e42fab882405d6f8563b58b0d81381 Mon Sep 17 00:00:00 2001 From: Lorenzo Manacorda Date: Tue, 29 Oct 2024 11:31:41 +0100 Subject: [PATCH] only update labels on accepted RFCs --- .github/workflows/update-pr-labels.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update-pr-labels.yml b/.github/workflows/update-pr-labels.yml index eae7bf9..b23e9b7 100644 --- a/.github/workflows/update-pr-labels.yml +++ b/.github/workflows/update-pr-labels.yml @@ -16,14 +16,14 @@ jobs: - run: nix-env -iA nixpkgs.github-cli - - name: Update PR Labels + - name: Update labels on accepted RFCs 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 + # Only operate on PR if it has the `status: accepted` label + if gh pr view $PR_NUMBER --repo $REPO --json labels -q 'any(.[].name == "status: accepted")'; then + gh pr edit $PR_NUMBER --remove-label "status: accepted" --repo $REPO + gh pr edit $PR_NUMBER --add-label "status: merged" --repo $REPO + fi