From 046a66a032d9a3ca51bfe14f1e68e8a002e53849 Mon Sep 17 00:00:00 2001 From: David Raphi Date: Wed, 10 Dec 2025 11:55:46 +0530 Subject: [PATCH] feat!: Release workflow update --- .github/workflows/release.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6ae7b9b..ee5db77 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -173,12 +173,15 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Comment on merged PRs + - name: Label and comment on merged PRs if: steps.version.outputs.skip != 'true' run: | LATEST_TAG="${{ steps.get_tag.outputs.latest_tag }}" NEW_VERSION="${{ steps.version.outputs.new_version }}" + # Ensure "released" label exists + gh label create "released" --color "9ab87c" --description "Included in a release" 2>/dev/null || true + # Get PR numbers from commits since last tag if [ "$LATEST_TAG" = "v0.0.0" ]; then COMMITS=$(git log --pretty=format:"%H" HEAD) @@ -187,17 +190,22 @@ jobs: fi # Find PRs associated with these commits - COMMENTED_PRS="" + LABELED_PRS="" while IFS= read -r sha; do # Get PR number for this commit PR_DATA=$(gh pr list --state merged --search "$sha" --json number --jq '.[0].number' 2>/dev/null || echo "") if [ -n "$PR_DATA" ] && [ "$PR_DATA" != "null" ]; then - # Avoid duplicate comments - if [[ ! "$COMMENTED_PRS" =~ "$PR_DATA" ]]; then + # Avoid duplicate actions + if [[ ! "$LABELED_PRS" =~ "$PR_DATA" ]]; then + # Add "released" label + gh pr edit "$PR_DATA" --add-label "released" 2>/dev/null || true + + # Add comment with release link gh pr comment "$PR_DATA" --body "🚀 Released in [$NEW_VERSION](https://github.com/${{ github.repository }}/releases/tag/$NEW_VERSION)" 2>/dev/null || true - COMMENTED_PRS="${COMMENTED_PRS} ${PR_DATA}" - echo "Commented on PR #$PR_DATA" + + LABELED_PRS="${LABELED_PRS} ${PR_DATA}" + echo "Labeled and commented on PR #$PR_DATA" fi fi done <<< "$COMMITS"