From 953762eea2900c84044ac84ce800bcf4c140f2a1 Mon Sep 17 00:00:00 2001 From: Gary Kang Date: Tue, 17 Dec 2024 14:49:33 -0500 Subject: [PATCH 1/3] Skip RC process with 'Inactive RC' label --- .../github-actions-release-candidate.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/github-actions-release-candidate.yml b/.github/workflows/github-actions-release-candidate.yml index 8f1a7062f3..e0a2b73c1b 100644 --- a/.github/workflows/github-actions-release-candidate.yml +++ b/.github/workflows/github-actions-release-candidate.yml @@ -37,6 +37,31 @@ jobs: run: | git config --local user.name "${{ github.actor }}" git config --local user.email "${{ github.actor }}@users.noreply.github.com" + + - name: Check for "Inactive RC" label + id: check-inactive-rc + run: | + PR_NUMBER=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ + "https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" \ + | jq '.[0].number') + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + + if [ ! -z "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then + echo "✅ Successfully found PR number: $PR_NUMBER" + else + echo "❌ Unable to find PR number" + exit 1 + fi + + echo "Fetching labels for PR #$PR_NUMBER..." + LABELS=$(gh pr view $PR_NUMBER --json labels -q '.labels[].name' || echo "Failed to fetch labels") + echo "Found labels: $LABELS" + + if echo "$LABELS" | grep -iq "Inactive RC"; then + echo "⛔ PR has the 'Inactive RC' label. Skipping the release candidate process." + exit 0 + fi + - name: Get Semver Label id: get-label run: | @@ -60,6 +85,11 @@ jobs: exit 1 fi + if echo "$LABELS" | grep -iq "Inactive RC"; then + echo "⛔ PR has the 'Inactive RC' label. Skipping the release candidate process." + exit 0 # Exit the job early, skipping the rest of the workflow + fi + SEMVER_LABEL=$(echo "$LABELS" | grep -iE '^(major|minor|patch)$' || true) echo "Found Semver labels: $SEMVER_LABEL" From 1ba6ef60caf406ec74eac4ca7bee238876557a0a Mon Sep 17 00:00:00 2001 From: Gary Kang Date: Tue, 17 Dec 2024 16:37:43 -0500 Subject: [PATCH 2/3] Remove extra separate step --- .../github-actions-release-candidate.yml | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/.github/workflows/github-actions-release-candidate.yml b/.github/workflows/github-actions-release-candidate.yml index e0a2b73c1b..4b2d441b91 100644 --- a/.github/workflows/github-actions-release-candidate.yml +++ b/.github/workflows/github-actions-release-candidate.yml @@ -37,31 +37,6 @@ jobs: run: | git config --local user.name "${{ github.actor }}" git config --local user.email "${{ github.actor }}@users.noreply.github.com" - - - name: Check for "Inactive RC" label - id: check-inactive-rc - run: | - PR_NUMBER=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ - "https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" \ - | jq '.[0].number') - echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV - - if [ ! -z "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then - echo "✅ Successfully found PR number: $PR_NUMBER" - else - echo "❌ Unable to find PR number" - exit 1 - fi - - echo "Fetching labels for PR #$PR_NUMBER..." - LABELS=$(gh pr view $PR_NUMBER --json labels -q '.labels[].name' || echo "Failed to fetch labels") - echo "Found labels: $LABELS" - - if echo "$LABELS" | grep -iq "Inactive RC"; then - echo "⛔ PR has the 'Inactive RC' label. Skipping the release candidate process." - exit 0 - fi - - name: Get Semver Label id: get-label run: | From f7c03b8476399751db8f2b8dec520148c46c0015 Mon Sep 17 00:00:00 2001 From: Gary Kang <42440452+kangaree@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:02:50 -0500 Subject: [PATCH 3/3] Update .github/workflows/github-actions-release-candidate.yml Co-authored-by: Jasper Furniss --- .github/workflows/github-actions-release-candidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-actions-release-candidate.yml b/.github/workflows/github-actions-release-candidate.yml index 4b2d441b91..d3938cab2a 100644 --- a/.github/workflows/github-actions-release-candidate.yml +++ b/.github/workflows/github-actions-release-candidate.yml @@ -61,7 +61,7 @@ jobs: fi if echo "$LABELS" | grep -iq "Inactive RC"; then - echo "⛔ PR has the 'Inactive RC' label. Skipping the release candidate process." + echo "⏭️ PR has the 'Inactive RC' label. Skipping the release candidate process." exit 0 # Exit the job early, skipping the rest of the workflow fi