From 0486733dd1a00516daf5efc7a18902624b6767ec Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:02:10 +0530 Subject: [PATCH 01/43] feat!: Updated terraform checks action adding preview release. BREAKING CHANGE: Testing release preview --- .github/workflows/terraform-checks.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index 87cd30a..32c7a85 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -8,6 +8,25 @@ env: TFLINT_VERSION: v0.52.0 jobs: + versionPreview: + name: Version Preview + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Release + uses: cycjimmy/semantic-release-action@v2 + with: + semantic_version: 18.0.0 + extra_plugins: | + @semantic-release/changelog@6.0.0 + @semantic-release/git@10.0.0 + conventional-changelog-conventionalcommits@4.6.3 + dry_run: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + test: name: Test runs-on: ubuntu-latest From 8ec5cf18973ba35f7bcb4b117f6ffaf821c76b53 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:07:08 +0530 Subject: [PATCH 02/43] fix: checkout to head --- .github/workflows/terraform-checks.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index 32c7a85..d19a582 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -14,6 +14,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} - name: Release uses: cycjimmy/semantic-release-action@v2 From 0648c64247fd34f49c04c28a5d6e482c5412e637 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:19:15 +0530 Subject: [PATCH 03/43] fix: using temperory Pr --- .github/workflows/terraform-checks.yaml | 28 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index d19a582..37aa0ab 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -14,21 +14,29 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} + + - name: Temporarily merge PR branch + if: ${{ github.event_name == 'pull_request' }} + run: | + git config --global user.name github-actions + git config --global user.email github-actions@github.com + git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "${{ github.event.pull_request.title }}" - - name: Release - uses: cycjimmy/semantic-release-action@v2 + - name: Semantic Release + id: semantic-release + uses: cycjimmy/semantic-release-action@v6 with: - semantic_version: 18.0.0 - extra_plugins: | - @semantic-release/changelog@6.0.0 - @semantic-release/git@10.0.0 - conventional-changelog-conventionalcommits@4.6.3 - dry_run: true + unset_gha_env: ${{ github.event_name == 'pull_request' }} + ci: ${{ github.event_name == 'pull_request' && false || '' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Show version preview output + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "Version Preview: ${{ steps.semantic-release.outputs.new_release_version || 'No new version' }}" + echo "Previous Version: ${{ steps.semantic-release.outputs.last_release_version || 'No previous version' }}" + test: name: Test runs-on: ubuntu-latest From c487808d3973db8c945851c773555dc7863e219e Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:26:12 +0530 Subject: [PATCH 04/43] fix: updated version. --- .github/workflows/terraform-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index 37aa0ab..06ebbe9 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Temporarily merge PR branch if: ${{ github.event_name == 'pull_request' }} From 2e7468543e098a748430a4a5638d6ddf292bd614 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:30:04 +0530 Subject: [PATCH 05/43] temp message --- .github/workflows/terraform-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index 06ebbe9..ae2ccb6 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -20,7 +20,7 @@ jobs: run: | git config --global user.name github-actions git config --global user.email github-actions@github.com - git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "${{ github.event.pull_request.title }}" + git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "Test" - name: Semantic Release id: semantic-release From d4e04f39481cbd3c7ce3a0906490585e0491d541 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:33:40 +0530 Subject: [PATCH 06/43] removed git conf --- .github/workflows/terraform-checks.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index ae2ccb6..db20f16 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -18,8 +18,6 @@ jobs: - name: Temporarily merge PR branch if: ${{ github.event_name == 'pull_request' }} run: | - git config --global user.name github-actions - git config --global user.email github-actions@github.com git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "Test" - name: Semantic Release From 2d82f831997d9ecda37eba91ba37f37a21cf1035 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:43:24 +0530 Subject: [PATCH 07/43] fetch git remote --- .github/workflows/terraform-checks.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index db20f16..b2438b7 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -17,8 +17,9 @@ jobs: - name: Temporarily merge PR branch if: ${{ github.event_name == 'pull_request' }} - run: | - git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "Test" + run: + git remote -v + git merge --no-ff ${{ github.event.pull_request.head.ref }} --message "Test" - name: Semantic Release id: semantic-release From 9e969c7dbbb877d4da85827dac882f37d968d2ae Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:44:38 +0530 Subject: [PATCH 08/43] made few changes in terraform checks --- .github/workflows/terraform-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index b2438b7..b175afe 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -17,7 +17,7 @@ jobs: - name: Temporarily merge PR branch if: ${{ github.event_name == 'pull_request' }} - run: + run: | git remote -v git merge --no-ff ${{ github.event.pull_request.head.ref }} --message "Test" From 39a57502374e7092dc0fd401ab71bc7f126df882 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:48:16 +0530 Subject: [PATCH 09/43] made workflow changes --- .github/workflows/terraform-checks.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index b175afe..305365b 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -14,6 +14,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v5 + with: + ref: ${{github.event.pull_request.head.ref }} + fetch-depth: 0 - name: Temporarily merge PR branch if: ${{ github.event_name == 'pull_request' }} From 71c8f7901fdf82eb284b8e6581c8657dd05a56b4 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:53:39 +0530 Subject: [PATCH 10/43] made few changes in git workflow. --- .github/workflows/terraform-checks.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index 305365b..ee97bfa 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -21,8 +21,9 @@ jobs: - name: Temporarily merge PR branch if: ${{ github.event_name == 'pull_request' }} run: | - git remote -v - git merge --no-ff ${{ github.event.pull_request.head.ref }} --message "Test" + git checkout main + git checkout -b temp-merge-branch + git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "Test" - name: Semantic Release id: semantic-release From d4da3ba5f92050b2057c7bc684ef07cb2dca5d9e Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:55:05 +0530 Subject: [PATCH 11/43] test --- .github/workflows/terraform-checks.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index ee97bfa..32060e0 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -21,6 +21,8 @@ jobs: - name: Temporarily merge PR branch if: ${{ github.event_name == 'pull_request' }} run: | + git config --global user.name github-actions + git config --global user.email github-actions@github.com git checkout main git checkout -b temp-merge-branch git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "Test" From f2b390d4c0e5ef470a2e59538d73f7b305ff235e Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Tue, 2 Dec 2025 23:58:39 +0530 Subject: [PATCH 12/43] feat!: Made changes in cross account BREAKING CHANGE: Updated readme. --- examples/cross-account/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/cross-account/README.md b/examples/cross-account/README.md index 4a809d3..70ba35e 100644 --- a/examples/cross-account/README.md +++ b/examples/cross-account/README.md @@ -26,7 +26,7 @@ route53:ChangeResourceRecordSets route53:ListHostedZonesByName route53:ListResourceRecordSets -And a trust policy allowing Account A to assume the role. +And a trust policy which allows Account A to assume the role. ## Example `tfvars` Configuration From 81394c517aaf942a2abfd53d41262ac491604ec5 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 00:01:37 +0530 Subject: [PATCH 13/43] test --- .github/workflows/terraform-checks.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index 32060e0..d72cb33 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -27,15 +27,20 @@ jobs: git checkout -b temp-merge-branch git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "Test" - - name: Semantic Release + - name: Release id: semantic-release - uses: cycjimmy/semantic-release-action@v6 + uses: cycjimmy/semantic-release-action@v2 with: - unset_gha_env: ${{ github.event_name == 'pull_request' }} - ci: ${{ github.event_name == 'pull_request' && false || '' }} + semantic_version: 18.0.0 + extra_plugins: | + @semantic-release/changelog@6.0.0 + @semantic-release/git@10.0.0 + conventional-changelog-conventionalcommits@4.6.3 + dry_run: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Show version preview output if: ${{ github.event_name == 'pull_request' }} run: | From 58c27cb808de3e7754181075e1d92956e6919be8 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 00:20:52 +0530 Subject: [PATCH 14/43] test --- .github/workflows/terraform-checks.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index d72cb33..c93d9fd 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -36,6 +36,10 @@ jobs: @semantic-release/changelog@6.0.0 @semantic-release/git@10.0.0 conventional-changelog-conventionalcommits@4.6.3 + branches: | + [ + 'debug-release', + ] dry_run: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f27c9b05c149ec5ddae2af9d21738a215338e40b Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 00:28:32 +0530 Subject: [PATCH 15/43] test --- .github/workflows/terraform-checks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index c93d9fd..81af970 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -41,6 +41,7 @@ jobs: 'debug-release', ] dry_run: true + ci: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9ce4b1ec242c5f330b7ad5eeda534d0ce837f9d1 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 00:31:29 +0530 Subject: [PATCH 16/43] test --- .github/workflows/terraform-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index 81af970..aae6430 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -29,7 +29,7 @@ jobs: - name: Release id: semantic-release - uses: cycjimmy/semantic-release-action@v2 + uses: cycjimmy/semantic-release-action@v6 with: semantic_version: 18.0.0 extra_plugins: | From 9f05799b673c8d12c3d2cb454bcf22b0a7f839f3 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 00:34:15 +0530 Subject: [PATCH 17/43] test --- .github/workflows/terraform-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index aae6430..aef74e6 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -38,7 +38,7 @@ jobs: conventional-changelog-conventionalcommits@4.6.3 branches: | [ - 'debug-release', + `*` ] dry_run: true ci: false From 9a87e366a9481f39be06ec8ed65f79d5949758ba Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 00:35:50 +0530 Subject: [PATCH 18/43] test --- .github/workflows/terraform-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index aef74e6..05a0d04 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -38,7 +38,7 @@ jobs: conventional-changelog-conventionalcommits@4.6.3 branches: | [ - `*` + 'refs/pull/29/merge' ] dry_run: true ci: false From 01a2ba03da8f5acdda9a469d0e3d5b2e4b647d43 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 00:38:12 +0530 Subject: [PATCH 19/43] test --- .github/workflows/terraform-checks.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index 05a0d04..152e6be 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -36,10 +36,6 @@ jobs: @semantic-release/changelog@6.0.0 @semantic-release/git@10.0.0 conventional-changelog-conventionalcommits@4.6.3 - branches: | - [ - 'refs/pull/29/merge' - ] dry_run: true ci: false env: From c59cf947cf6326a6079befcf33fc845b92ea97a9 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 00:47:36 +0530 Subject: [PATCH 20/43] test. --- .github/workflows/terraform-checks.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index 152e6be..deb9f1d 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -38,6 +38,10 @@ jobs: conventional-changelog-conventionalcommits@4.6.3 dry_run: true ci: false + branches: | + [ + `${{ github.event.pull_request.head.ref }}` + ] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d7012bca1ce1b50849115ddf06356c9829fed7ba Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 11:09:51 +0530 Subject: [PATCH 21/43] updated release Preview. --- .github/workflows/release-preview.yaml | 144 ++++++++++++++++++++++++ .github/workflows/terraform-checks.yaml | 44 -------- .github/workflows/terraform.yaml | 8 ++ 3 files changed, 152 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/release-preview.yaml diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml new file mode 100644 index 0000000..bf17d47 --- /dev/null +++ b/.github/workflows/release-preview.yaml @@ -0,0 +1,144 @@ +name: Release Preview + +on: + workflow_call: + +jobs: + preview: + name: Preview Release + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + + - name: Install semantic-release + run: | + npm install -g semantic-release@18.0.0 \ + @semantic-release/commit-analyzer@9.0.2 \ + @semantic-release/release-notes-generator@10.0.3 \ + @semantic-release/github@8.0.7 \ + conventional-changelog-conventionalcommits@4.6.3 + + - name: Run semantic-release (dry-run) + id: semantic + run: | + # Run semantic-release in dry-run mode and capture output + OUTPUT=$(npx semantic-release --dry-run --no-ci 2>&1 || true) + echo "$OUTPUT" + + # Extract version information + NEW_VERSION=$(echo "$OUTPUT" | grep -oP "The next release version is \K[0-9]+\.[0-9]+\.[0-9]+" || echo "") + RELEASE_TYPE=$(echo "$OUTPUT" | grep -oP "Analysis of \d+ commits complete: \K\w+ release" | sed 's/ release//' || echo "") + + # Save to outputs + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT + echo "release_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT + + # Save full output for comment + echo "full_output<> $GITHUB_OUTPUT + echo "$OUTPUT" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Display Preview + run: | + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo " RELEASE PREVIEW" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "" + if [ -n "${{ steps.semantic.outputs.new_version }}" ]; then + echo "Version: v${{ steps.semantic.outputs.new_version }}" + echo "Release Type: ${{ steps.semantic.outputs.release_type }}" + echo "Status: Release will be published" + else + echo "Status: No release will be published" + echo "Reason: No relevant changes detected" + fi + echo "" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + + - name: Comment on PR + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + script: | + const newVersion = '${{ steps.semantic.outputs.new_version }}'; + const releaseType = '${{ steps.semantic.outputs.release_type }}'; + + let body; + if (newVersion) { + body = `## Release Preview + + **Version:** \`v${newVersion}\` + **Release Type:** \`${releaseType}\` + **Status:** Release will be published when merged to main + +
+ View semantic-release analysis + + \`\`\` + ${{ steps.semantic.outputs.full_output }} + \`\`\` +
+ + --- + *This preview is generated by semantic-release dry-run mode*`; + } else { + body = `## Release Preview + + **Status:** No release will be published + **Reason:** No relevant changes detected + +
+ View semantic-release analysis + + \`\`\` + ${{ steps.semantic.outputs.full_output }} + \`\`\` +
+ + --- + *This preview is generated by semantic-release dry-run mode*`; + } + + // Find existing comment + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + + const botComment = comments.find(comment => + comment.user.type === 'Bot' && + comment.body.includes('Release Preview') + ); + + // Update or create comment + if (botComment) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + body: body + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: body + }); + } diff --git a/.github/workflows/terraform-checks.yaml b/.github/workflows/terraform-checks.yaml index deb9f1d..87cd30a 100644 --- a/.github/workflows/terraform-checks.yaml +++ b/.github/workflows/terraform-checks.yaml @@ -8,50 +8,6 @@ env: TFLINT_VERSION: v0.52.0 jobs: - versionPreview: - name: Version Preview - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v5 - with: - ref: ${{github.event.pull_request.head.ref }} - fetch-depth: 0 - - - name: Temporarily merge PR branch - if: ${{ github.event_name == 'pull_request' }} - run: | - git config --global user.name github-actions - git config --global user.email github-actions@github.com - git checkout main - git checkout -b temp-merge-branch - git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "Test" - - - name: Release - id: semantic-release - uses: cycjimmy/semantic-release-action@v6 - with: - semantic_version: 18.0.0 - extra_plugins: | - @semantic-release/changelog@6.0.0 - @semantic-release/git@10.0.0 - conventional-changelog-conventionalcommits@4.6.3 - dry_run: true - ci: false - branches: | - [ - `${{ github.event.pull_request.head.ref }}` - ] - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - - name: Show version preview output - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "Version Preview: ${{ steps.semantic-release.outputs.new_release_version || 'No new version' }}" - echo "Previous Version: ${{ steps.semantic-release.outputs.last_release_version || 'No previous version' }}" - test: name: Test runs-on: ubuntu-latest diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml index 3c55029..509de04 100644 --- a/.github/workflows/terraform.yaml +++ b/.github/workflows/terraform.yaml @@ -15,6 +15,14 @@ on: - main - master jobs: + releasePreview: + name: Release Preview + if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + uses: ./.github/workflows/release-preview.yaml + permissions: + contents: read + pull-requests: write + preCommitCheck: name: Terraform Checks uses: ./.github/workflows/terraform-checks.yaml From e538e0edba5dcc4f6489ac1d5289dc3fa68decad Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 11:14:17 +0530 Subject: [PATCH 22/43] updated release.yaml --- .github/workflows/release-preview.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index bf17d47..dd2997a 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -16,7 +16,16 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }} + ref: ${{ github.event.pull_request.head.ref }} + + - name: Simulate merge to main + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git fetch origin main + git checkout main + git checkout -b temp-preview-branch + git merge --no-ff origin/${{ github.event.pull_request.head.ref }} -m "temp: simulate PR merge for release preview" - name: Setup Node.js uses: actions/setup-node@v4 From 8d60de06aefc88fb6abad50b739b75a69461b0ff Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 11:21:28 +0530 Subject: [PATCH 23/43] made changes in preview release file --- .github/workflows/release-preview.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index dd2997a..7eccad0 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -23,9 +23,11 @@ jobs: git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" git fetch origin main - git checkout main - git checkout -b temp-preview-branch + git checkout -B main origin/main git merge --no-ff origin/${{ github.event.pull_request.head.ref }} -m "temp: simulate PR merge for release preview" + echo "Current branch: $(git branch --show-current)" + echo "Latest commits:" + git log --oneline -5 - name: Setup Node.js uses: actions/setup-node@v4 @@ -44,7 +46,8 @@ jobs: id: semantic run: | # Run semantic-release in dry-run mode and capture output - OUTPUT=$(npx semantic-release --dry-run --no-ci 2>&1 || true) + # Override branch config to treat current branch as 'main' + OUTPUT=$(npx semantic-release --dry-run --no-ci --branches main 2>&1 || true) echo "$OUTPUT" # Extract version information From da7679110c62b34a165a5eaea48dc4caea5eb7d3 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 11:33:30 +0530 Subject: [PATCH 24/43] updated release added ref to main branch --- .github/workflows/release-preview.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 7eccad0..059ef6d 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -50,9 +50,9 @@ jobs: OUTPUT=$(npx semantic-release --dry-run --no-ci --branches main 2>&1 || true) echo "$OUTPUT" - # Extract version information - NEW_VERSION=$(echo "$OUTPUT" | grep -oP "The next release version is \K[0-9]+\.[0-9]+\.[0-9]+" || echo "") - RELEASE_TYPE=$(echo "$OUTPUT" | grep -oP "Analysis of \d+ commits complete: \K\w+ release" | sed 's/ release//' || echo "") + # Extract version information (compatible with both GNU and BSD grep) + NEW_VERSION=$(echo "$OUTPUT" | grep -Eo "The next release version is [0-9]+\.[0-9]+\.[0-9]+" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" || echo "") + RELEASE_TYPE=$(echo "$OUTPUT" | grep -Eo "Analysis of [0-9]+ commits complete: [a-z]+ release" | grep -Eo "(major|minor|patch) release" | sed 's/ release//' || echo "") # Save to outputs echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT @@ -64,6 +64,8 @@ jobs: echo "EOF" >> $GITHUB_OUTPUT env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REF: refs/heads/main + GITHUB_REF_NAME: main - name: Display Preview run: | From 44f286144daa26f18d697a12d6d978d4b6bcd4f8 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 11:48:24 +0530 Subject: [PATCH 25/43] updated release preview file. --- .github/workflows/release-preview.yaml | 33 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 059ef6d..f7abc96 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -36,21 +36,38 @@ jobs: - name: Install semantic-release run: | - npm install -g semantic-release@18.0.0 \ + npm install --save-dev semantic-release@18.0.0 \ @semantic-release/commit-analyzer@9.0.2 \ @semantic-release/release-notes-generator@10.0.3 \ - @semantic-release/github@8.0.7 \ conventional-changelog-conventionalcommits@4.6.3 + - name: Create preview config + run: | + # Create a config without GitHub plugin for preview (avoids token validation) + cat > .releaserc.preview.json << 'EOF' + { + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator" + ] + } + EOF + - name: Run semantic-release (dry-run) id: semantic run: | - # Run semantic-release in dry-run mode and capture output - # Override branch config to treat current branch as 'main' - OUTPUT=$(npx semantic-release --dry-run --no-ci --branches main 2>&1 || true) + # Temporarily rename main config to use preview config only + mv .releaserc.json .releaserc.json.bak + + # Run semantic-release in dry-run mode with preview config only + OUTPUT=$(npx semantic-release --extends ./.releaserc.preview.json --dry-run --no-ci 2>&1 || true) echo "$OUTPUT" - # Extract version information (compatible with both GNU and BSD grep) + # Restore main config + mv .releaserc.json.bak .releaserc.json + + # Extract version information NEW_VERSION=$(echo "$OUTPUT" | grep -Eo "The next release version is [0-9]+\.[0-9]+\.[0-9]+" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" || echo "") RELEASE_TYPE=$(echo "$OUTPUT" | grep -Eo "Analysis of [0-9]+ commits complete: [a-z]+ release" | grep -Eo "(major|minor|patch) release" | sed 's/ release//' || echo "") @@ -62,10 +79,6 @@ jobs: echo "full_output<> $GITHUB_OUTPUT echo "$OUTPUT" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_REF: refs/heads/main - GITHUB_REF_NAME: main - name: Display Preview run: | From ceb7576060630fb4a684f274daa3a281b3700651 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 12:28:02 +0530 Subject: [PATCH 26/43] made changes in preview.yaml file. --- .github/workflows/release-preview.yaml | 31 +++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index f7abc96..220f041 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -34,37 +34,36 @@ jobs: with: node-version: 'lts/*' - - name: Install semantic-release + - name: Update config for preview run: | - npm install --save-dev semantic-release@18.0.0 \ - @semantic-release/commit-analyzer@9.0.2 \ - @semantic-release/release-notes-generator@10.0.3 \ - conventional-changelog-conventionalcommits@4.6.3 + # Backup original config + cp .releaserc.json .releaserc.json.bak - - name: Create preview config - run: | - # Create a config without GitHub plugin for preview (avoids token validation) - cat > .releaserc.preview.json << 'EOF' + # Update config for preview mode (branch is main since we merged in previous step) + cat > .releaserc.json << 'EOF' { "branches": ["main"], + "debug": true, + "ci": false, + "dryRun": true, "plugins": [ "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator" + "@semantic-release/release-notes-generator", + "@semantic-release/github" ] } EOF - name: Run semantic-release (dry-run) id: semantic + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # Temporarily rename main config to use preview config only - mv .releaserc.json .releaserc.json.bak - - # Run semantic-release in dry-run mode with preview config only - OUTPUT=$(npx semantic-release --extends ./.releaserc.preview.json --dry-run --no-ci 2>&1 || true) + # Run semantic-release with inline package installation (same as your local command) + OUTPUT=$(npx --package semantic-release --package @semantic-release/exec --package conventional-changelog-conventionalcommits semantic-release 2>&1 || true) echo "$OUTPUT" - # Restore main config + # Restore original config mv .releaserc.json.bak .releaserc.json # Extract version information From 3e4c75debc728d2e676fc56ed65231c863cf909e Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 12:39:59 +0530 Subject: [PATCH 27/43] Made changes in release preview to check if semantic api response is fine --- .github/workflows/release-preview.yaml | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 220f041..38c92f7 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -18,17 +18,6 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} - - name: Simulate merge to main - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git fetch origin main - git checkout -B main origin/main - git merge --no-ff origin/${{ github.event.pull_request.head.ref }} -m "temp: simulate PR merge for release preview" - echo "Current branch: $(git branch --show-current)" - echo "Latest commits:" - git log --oneline -5 - - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -39,10 +28,10 @@ jobs: # Backup original config cp .releaserc.json .releaserc.json.bak - # Update config for preview mode (branch is main since we merged in previous step) - cat > .releaserc.json << 'EOF' + # Update config for preview mode using the PR branch name + cat > .releaserc.json << EOF { - "branches": ["main"], + "branches": ["${{ github.event.pull_request.head.ref }}"], "debug": true, "ci": false, "dryRun": true, @@ -54,6 +43,8 @@ jobs: } EOF + echo "Updated .releaserc.json for branch: ${{ github.event.pull_request.head.ref }}" + - name: Run semantic-release (dry-run) id: semantic env: From 789ac3c8901df22f274b0f98b86f485086f01809 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 12:49:01 +0530 Subject: [PATCH 28/43] test --- .github/workflows/release-preview.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 38c92f7..c84c4e3 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -49,7 +49,13 @@ jobs: id: semantic env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Override GitHub's environment variables to make semantic-release see the actual PR branch + GITHUB_REF: refs/heads/${{ github.event.pull_request.head.ref }} + GITHUB_REF_NAME: ${{ github.event.pull_request.head.ref }} + GITHUB_HEAD_REF: "" run: | + echo "Running semantic-release on branch: ${{ github.event.pull_request.head.ref }}" + # Run semantic-release with inline package installation (same as your local command) OUTPUT=$(npx --package semantic-release --package @semantic-release/exec --package conventional-changelog-conventionalcommits semantic-release 2>&1 || true) echo "$OUTPUT" From 3b878d87f5008f388a27edf900a4722bc5771f3b Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 14:08:37 +0530 Subject: [PATCH 29/43] test changes. --- .github/workflows/release-preview.yaml | 28 ++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index c84c4e3..7d90a6b 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -18,6 +18,14 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} + - name: Setup branch for semantic-release + run: | + # Explicitly checkout to the PR branch by name + git checkout -B ${{ github.event.pull_request.head.ref }} + echo "Current branch: $(git branch --show-current)" + echo "Git status:" + git status + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -28,6 +36,11 @@ jobs: # Backup original config cp .releaserc.json .releaserc.json.bak + echo "=== Original .releaserc.json ===" + cat .releaserc.json.bak + echo "================================" + echo "" + # Update config for preview mode using the PR branch name cat > .releaserc.json << EOF { @@ -43,7 +56,11 @@ jobs: } EOF - echo "Updated .releaserc.json for branch: ${{ github.event.pull_request.head.ref }}" + echo "=== Updated .releaserc.json ===" + cat .releaserc.json + echo "===============================" + echo "" + echo "Config updated for branch: ${{ github.event.pull_request.head.ref }}" - name: Run semantic-release (dry-run) id: semantic @@ -54,7 +71,14 @@ jobs: GITHUB_REF_NAME: ${{ github.event.pull_request.head.ref }} GITHUB_HEAD_REF: "" run: | - echo "Running semantic-release on branch: ${{ github.event.pull_request.head.ref }}" + echo "=== Debug Info ===" + echo "Expected branch: ${{ github.event.pull_request.head.ref }}" + echo "Current git branch: $(git branch --show-current)" + echo "GITHUB_REF: $GITHUB_REF" + echo "GITHUB_REF_NAME: $GITHUB_REF_NAME" + echo "GITHUB_HEAD_REF: $GITHUB_HEAD_REF" + echo "==================" + echo "" # Run semantic-release with inline package installation (same as your local command) OUTPUT=$(npx --package semantic-release --package @semantic-release/exec --package conventional-changelog-conventionalcommits semantic-release 2>&1 || true) From c9cf5fb4b4277e2d9b95ab19af62145b2c5acdd3 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 14:11:42 +0530 Subject: [PATCH 30/43] check git ref. --- .github/workflows/release-preview.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 7d90a6b..b533cde 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -66,11 +66,17 @@ jobs: id: semantic env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Override GitHub's environment variables to make semantic-release see the actual PR branch - GITHUB_REF: refs/heads/${{ github.event.pull_request.head.ref }} - GITHUB_REF_NAME: ${{ github.event.pull_request.head.ref }} - GITHUB_HEAD_REF: "" run: | + # Unset GitHub Actions environment variables that interfere with semantic-release + unset GITHUB_REF + unset GITHUB_REF_NAME + unset GITHUB_HEAD_REF + unset GITHUB_BASE_REF + + # Set them to what we want + export GITHUB_REF="refs/heads/${{ github.event.pull_request.head.ref }}" + export GITHUB_REF_NAME="${{ github.event.pull_request.head.ref }}" + echo "=== Debug Info ===" echo "Expected branch: ${{ github.event.pull_request.head.ref }}" echo "Current git branch: $(git branch --show-current)" From 47776015125591f6513dd5c6b7135f586c5ba77e Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 14:23:15 +0530 Subject: [PATCH 31/43] test semantic changes. --- .github/workflows/release-preview.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index b533cde..988fe00 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -66,6 +66,11 @@ jobs: id: semantic env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Skip git verification to avoid needing write permissions + GIT_COMMITTER_NAME: "github-actions[bot]" + GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com" + GIT_AUTHOR_NAME: "github-actions[bot]" + GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com" run: | # Unset GitHub Actions environment variables that interfere with semantic-release unset GITHUB_REF @@ -77,6 +82,16 @@ jobs: export GITHUB_REF="refs/heads/${{ github.event.pull_request.head.ref }}" export GITHUB_REF_NAME="${{ github.event.pull_request.head.ref }}" + # Mock git push to avoid permission errors (semantic-release will skip actual push in dry-run) + git() { + if [[ "$1" == "push" ]]; then + echo "[DRY-RUN] Skipping git push verification" + return 0 + fi + command git "$@" + } + export -f git + echo "=== Debug Info ===" echo "Expected branch: ${{ github.event.pull_request.head.ref }}" echo "Current git branch: $(git branch --show-current)" From cd7a4fca1590aa12acdce80a8d986161231e1600 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 14:29:51 +0530 Subject: [PATCH 32/43] updated workflow. --- .github/workflows/release-preview.yaml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 988fe00..f65a739 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -8,7 +8,7 @@ jobs: name: Preview Release runs-on: ubuntu-latest permissions: - contents: read + contents: write # Required for semantic-release to verify git push (even in dry-run mode) pull-requests: write steps: @@ -66,7 +66,6 @@ jobs: id: semantic env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Skip git verification to avoid needing write permissions GIT_COMMITTER_NAME: "github-actions[bot]" GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com" GIT_AUTHOR_NAME: "github-actions[bot]" @@ -82,16 +81,6 @@ jobs: export GITHUB_REF="refs/heads/${{ github.event.pull_request.head.ref }}" export GITHUB_REF_NAME="${{ github.event.pull_request.head.ref }}" - # Mock git push to avoid permission errors (semantic-release will skip actual push in dry-run) - git() { - if [[ "$1" == "push" ]]; then - echo "[DRY-RUN] Skipping git push verification" - return 0 - fi - command git "$@" - } - export -f git - echo "=== Debug Info ===" echo "Expected branch: ${{ github.event.pull_request.head.ref }}" echo "Current git branch: $(git branch --show-current)" From d96675aa0514fe50857a3d7a33aab439f9167fc4 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 14:39:46 +0530 Subject: [PATCH 33/43] Updated terraform yaml file. --- .github/workflows/terraform.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml index 509de04..6b05110 100644 --- a/.github/workflows/terraform.yaml +++ b/.github/workflows/terraform.yaml @@ -20,7 +20,7 @@ jobs: if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} uses: ./.github/workflows/release-preview.yaml permissions: - contents: read + contents: write pull-requests: write preCommitCheck: From eca425b2762bb796f2cb060a060095e32c3692dd Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 14:58:49 +0530 Subject: [PATCH 34/43] Made changes for getting proper comments. --- .github/workflows/release-preview.yaml | 73 ++++++++++++++++---------- 1 file changed, 45 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index f65a739..becd6bf 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -8,7 +8,7 @@ jobs: name: Preview Release runs-on: ubuntu-latest permissions: - contents: write # Required for semantic-release to verify git push (even in dry-run mode) + contents: write pull-requests: write steps: @@ -101,13 +101,16 @@ jobs: NEW_VERSION=$(echo "$OUTPUT" | grep -Eo "The next release version is [0-9]+\.[0-9]+\.[0-9]+" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" || echo "") RELEASE_TYPE=$(echo "$OUTPUT" | grep -Eo "Analysis of [0-9]+ commits complete: [a-z]+ release" | grep -Eo "(major|minor|patch) release" | sed 's/ release//' || echo "") + # Extract release notes (everything after "Release note for version") + RELEASE_NOTES=$(echo "$OUTPUT" | sed -n '/Release note for version/,$p' | tail -n +2 || echo "") + # Save to outputs echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT echo "release_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT - # Save full output for comment - echo "full_output<> $GITHUB_OUTPUT - echo "$OUTPUT" >> $GITHUB_OUTPUT + # Save release notes for comment + echo "release_notes<> $GITHUB_OUTPUT + echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - name: Display Preview @@ -135,41 +138,55 @@ jobs: const newVersion = '${{ steps.semantic.outputs.new_version }}'; const releaseType = '${{ steps.semantic.outputs.release_type }}'; + const releaseNotes = `${{ steps.semantic.outputs.release_notes }}`; + let body; if (newVersion) { body = `## Release Preview - **Version:** \`v${newVersion}\` - **Release Type:** \`${releaseType}\` - **Status:** Release will be published when merged to main + **Version:** \`v${newVersion}\` + **Release Type:** \`${releaseType}\` + **Status:** Release will be published when merged to main -
- View semantic-release analysis + --- - \`\`\` - ${{ steps.semantic.outputs.full_output }} - \`\`\` -
+ ### Release Notes - --- - *This preview is generated by semantic-release dry-run mode*`; - } else { - body = `## Release Preview + ${releaseNotes} - **Status:** No release will be published - **Reason:** No relevant changes detected + --- -
- View semantic-release analysis +
+ View full semantic-release log - \`\`\` - ${{ steps.semantic.outputs.full_output }} - \`\`\` -
+ \`\`\` + ${{ steps.semantic.outputs.full_output }} + \`\`\` +
- --- - *This preview is generated by semantic-release dry-run mode*`; - } + --- + + *This preview is generated by [semantic-release](https://github.com/semantic-release/semantic-release) dry-run mode*`; + } else { + body = `## Release Preview + + **Status:** No release will be published + **Reason:** No relevant changes detected + + --- + +
+ View full semantic-release log + + \`\`\` + ${{ steps.semantic.outputs.full_output }} + \`\`\` +
+ + --- + + *This preview is generated by [semantic-release](https://github.com/semantic-release/semantic-release) dry-run mode*`; + } // Find existing comment const { data: comments } = await github.rest.issues.listComments({ From 46576fda7dc944fabdcc865cb1ceff0c867161ec Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 15:04:53 +0530 Subject: [PATCH 35/43] updated Github actions preview release notes. --- .github/workflows/release-preview.yaml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index becd6bf..7aa86f7 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -156,19 +156,10 @@ jobs: --- -
- View full semantic-release log - - \`\`\` - ${{ steps.semantic.outputs.full_output }} - \`\`\` -
- - --- - - *This preview is generated by [semantic-release](https://github.com/semantic-release/semantic-release) dry-run mode*`; - } else { - body = `## Release Preview + *This preview is generated by semantic-release dry-run mode*`; + } + else { + body = `## Release Preview **Status:** No release will be published **Reason:** No relevant changes detected @@ -185,8 +176,8 @@ jobs: --- - *This preview is generated by [semantic-release](https://github.com/semantic-release/semantic-release) dry-run mode*`; - } + *This preview is generated by semantic-release dry-run mode*`; + } // Find existing comment const { data: comments } = await github.rest.issues.listComments({ From e167ceba0da2866713e8cc85e76113e27c75ba31 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 15:19:42 +0530 Subject: [PATCH 36/43] Cleared white spaces. --- .github/workflows/release-preview.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 7aa86f7..096368b 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -157,7 +157,7 @@ jobs: --- *This preview is generated by semantic-release dry-run mode*`; - } + } else { body = `## Release Preview From db629366b3c28044d44a2af4aea5758518432982 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 17:12:30 +0530 Subject: [PATCH 37/43] Made changes for preview-releaserc.json --- .github/workflows/release-preview.yaml | 45 +++++++++++--------------- .preview-releaserc.json | 11 +++++++ 2 files changed, 29 insertions(+), 27 deletions(-) create mode 100644 .preview-releaserc.json diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 096368b..69d6d23 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -31,36 +31,22 @@ jobs: with: node-version: 'lts/*' - - name: Update config for preview + - name: Setup preview config run: | - # Backup original config - cp .releaserc.json .releaserc.json.bak - - echo "=== Original .releaserc.json ===" - cat .releaserc.json.bak - echo "================================" + echo "=== Main .releaserc.json ===" + cat .releaserc.json + echo "==============================" echo "" - # Update config for preview mode using the PR branch name - cat > .releaserc.json << EOF - { - "branches": ["${{ github.event.pull_request.head.ref }}"], - "debug": true, - "ci": false, - "dryRun": true, - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/github" - ] - } - EOF - - echo "=== Updated .releaserc.json ===" - cat .releaserc.json - echo "===============================" + # Update preview config with the PR branch name + sed -i.bak "s/BRANCH_PLACEHOLDER/${{ github.event.pull_request.head.ref }}/g" .preview-releaserc.json + rm .preview-releaserc.json.bak + + echo "=== Preview .preview-releaserc.json ===" + cat .preview-releaserc.json + echo "========================================" echo "" - echo "Config updated for branch: ${{ github.event.pull_request.head.ref }}" + echo "Preview config ready for branch: ${{ github.event.pull_request.head.ref }}" - name: Run semantic-release (dry-run) id: semantic @@ -90,12 +76,17 @@ jobs: echo "==================" echo "" + # Temporarily use preview config + mv .releaserc.json .releaserc.json.main + cp .preview-releaserc.json .releaserc.json + # Run semantic-release with inline package installation (same as your local command) OUTPUT=$(npx --package semantic-release --package @semantic-release/exec --package conventional-changelog-conventionalcommits semantic-release 2>&1 || true) echo "$OUTPUT" # Restore original config - mv .releaserc.json.bak .releaserc.json + rm .releaserc.json + mv .releaserc.json.main .releaserc.json # Extract version information NEW_VERSION=$(echo "$OUTPUT" | grep -Eo "The next release version is [0-9]+\.[0-9]+\.[0-9]+" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" || echo "") diff --git a/.preview-releaserc.json b/.preview-releaserc.json new file mode 100644 index 0000000..d000f8a --- /dev/null +++ b/.preview-releaserc.json @@ -0,0 +1,11 @@ +{ + "branches": ["BRANCH_PLACEHOLDER"], + "debug": true, + "ci": false, + "dryRun": true, + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/github" + ] +} From 61e6099b265ddeb56c752b7ea7d5bc4834a04db8 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Wed, 3 Dec 2025 17:23:27 +0530 Subject: [PATCH 38/43] fix: Updated release-preview with removing unwanted displays. --- .github/workflows/release-preview.yaml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 69d6d23..583112e 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -22,9 +22,6 @@ jobs: run: | # Explicitly checkout to the PR branch by name git checkout -B ${{ github.event.pull_request.head.ref }} - echo "Current branch: $(git branch --show-current)" - echo "Git status:" - git status - name: Setup Node.js uses: actions/setup-node@v4 @@ -33,21 +30,10 @@ jobs: - name: Setup preview config run: | - echo "=== Main .releaserc.json ===" - cat .releaserc.json - echo "==============================" - echo "" - # Update preview config with the PR branch name sed -i.bak "s/BRANCH_PLACEHOLDER/${{ github.event.pull_request.head.ref }}/g" .preview-releaserc.json rm .preview-releaserc.json.bak - echo "=== Preview .preview-releaserc.json ===" - cat .preview-releaserc.json - echo "========================================" - echo "" - echo "Preview config ready for branch: ${{ github.event.pull_request.head.ref }}" - - name: Run semantic-release (dry-run) id: semantic env: @@ -67,15 +53,6 @@ jobs: export GITHUB_REF="refs/heads/${{ github.event.pull_request.head.ref }}" export GITHUB_REF_NAME="${{ github.event.pull_request.head.ref }}" - echo "=== Debug Info ===" - echo "Expected branch: ${{ github.event.pull_request.head.ref }}" - echo "Current git branch: $(git branch --show-current)" - echo "GITHUB_REF: $GITHUB_REF" - echo "GITHUB_REF_NAME: $GITHUB_REF_NAME" - echo "GITHUB_HEAD_REF: $GITHUB_HEAD_REF" - echo "==================" - echo "" - # Temporarily use preview config mv .releaserc.json .releaserc.json.main cp .preview-releaserc.json .releaserc.json From 3dcc8e2ac899e2152d6ab9de67487a4887dea717 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Thu, 4 Dec 2025 00:15:11 +0530 Subject: [PATCH 39/43] Updated few changes in semantic release --- .github/workflows/release-preview.yaml | 108 ++++++------------------- 1 file changed, 25 insertions(+), 83 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 583112e..2bf5745 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -3,6 +3,10 @@ name: Release Preview on: workflow_call: +env: + SEMANTIC_RELEASE_VERSION: '24.2.0' + NODE_VERSION: '20.x' + jobs: preview: name: Preview Release @@ -18,21 +22,10 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} - - name: Setup branch for semantic-release - run: | - # Explicitly checkout to the PR branch by name - git checkout -B ${{ github.event.pull_request.head.ref }} - - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 'lts/*' - - - name: Setup preview config - run: | - # Update preview config with the PR branch name - sed -i.bak "s/BRANCH_PLACEHOLDER/${{ github.event.pull_request.head.ref }}/g" .preview-releaserc.json - rm .preview-releaserc.json.bak + node-version: ${{ env.NODE_VERSION }} - name: Run semantic-release (dry-run) id: semantic @@ -53,18 +46,17 @@ jobs: export GITHUB_REF="refs/heads/${{ github.event.pull_request.head.ref }}" export GITHUB_REF_NAME="${{ github.event.pull_request.head.ref }}" - # Temporarily use preview config - mv .releaserc.json .releaserc.json.main - cp .preview-releaserc.json .releaserc.json - - # Run semantic-release with inline package installation (same as your local command) - OUTPUT=$(npx --package semantic-release --package @semantic-release/exec --package conventional-changelog-conventionalcommits semantic-release 2>&1 || true) + # Run semantic-release with inline configuration using CLI options + OUTPUT=$(npx --package semantic-release@${{ env.SEMANTIC_RELEASE_VERSION }} \ + --package @semantic-release/exec \ + --package conventional-changelog-conventionalcommits \ + semantic-release \ + --dry-run \ + --no-ci \ + --debug \ + --branches ${{ github.event.pull_request.head.ref }} 2>&1 || true) echo "$OUTPUT" - # Restore original config - rm .releaserc.json - mv .releaserc.json.main .releaserc.json - # Extract version information NEW_VERSION=$(echo "$OUTPUT" | grep -Eo "The next release version is [0-9]+\.[0-9]+\.[0-9]+" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" || echo "") RELEASE_TYPE=$(echo "$OUTPUT" | grep -Eo "Analysis of [0-9]+ commits complete: [a-z]+ release" | grep -Eo "(major|minor|patch) release" | sed 's/ release//' || echo "") @@ -100,78 +92,28 @@ jobs: - name: Comment on PR if: github.event_name == 'pull_request' - uses: actions/github-script@v7 + uses: peter-evans/create-or-update-comment@v4 with: - script: | - const newVersion = '${{ steps.semantic.outputs.new_version }}'; - const releaseType = '${{ steps.semantic.outputs.release_type }}'; + issue-number: ${{ github.event.pull_request.number }} + body: | + ## Release Preview - const releaseNotes = `${{ steps.semantic.outputs.release_notes }}`; - - let body; - if (newVersion) { - body = `## Release Preview - - **Version:** \`v${newVersion}\` - **Release Type:** \`${releaseType}\` + ${{ steps.semantic.outputs.new_version && format('**Version:** `v{0}` + **Release Type:** `{1}` **Status:** Release will be published when merged to main --- - ### Release Notes + ### Release Notes - ${releaseNotes} + {2} --- - *This preview is generated by semantic-release dry-run mode*`; - } - else { - body = `## Release Preview - - **Status:** No release will be published + *This preview is generated by semantic-release dry-run mode*', steps.semantic.outputs.new_version, steps.semantic.outputs.release_type, steps.semantic.outputs.release_notes) || '**Status:** ❌ No release will be published **Reason:** No relevant changes detected --- -
- View full semantic-release log - - \`\`\` - ${{ steps.semantic.outputs.full_output }} - \`\`\` -
- - --- - - *This preview is generated by semantic-release dry-run mode*`; - } - - // Find existing comment - const { data: comments } = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - }); - - const botComment = comments.find(comment => - comment.user.type === 'Bot' && - comment.body.includes('Release Preview') - ); - - // Update or create comment - if (botComment) { - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: botComment.id, - body: body - }); - } else { - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: body - }); - } + *This preview is generated by semantic-release dry-run mode*' }} + edit-mode: replace From 00c4a8d84b75efabbe8cc58fd5104732db4218a4 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Thu, 4 Dec 2025 10:34:18 +0530 Subject: [PATCH 40/43] removed preview release.json --- .preview-releaserc.json | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 .preview-releaserc.json diff --git a/.preview-releaserc.json b/.preview-releaserc.json deleted file mode 100644 index d000f8a..0000000 --- a/.preview-releaserc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "branches": ["BRANCH_PLACEHOLDER"], - "debug": true, - "ci": false, - "dryRun": true, - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/github" - ] -} From c4f7bea3348626b71c16259d598f1779113eb630 Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Thu, 4 Dec 2025 10:52:35 +0530 Subject: [PATCH 41/43] ci: Updated release preview workflow --- .github/workflows/release-preview.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index 2bf5745..bb789b7 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -92,10 +92,10 @@ jobs: - name: Comment on PR if: github.event_name == 'pull_request' - uses: peter-evans/create-or-update-comment@v4 + uses: mshick/add-pr-comment@v2 with: - issue-number: ${{ github.event.pull_request.number }} - body: | + message-id: release-preview + message: | ## Release Preview ${{ steps.semantic.outputs.new_version && format('**Version:** `v{0}` @@ -116,4 +116,3 @@ jobs: --- *This preview is generated by semantic-release dry-run mode*' }} - edit-mode: replace From d9ec370d63adb64570aa91c4c99c7cd8b9925d6a Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Thu, 4 Dec 2025 10:57:13 +0530 Subject: [PATCH 42/43] Updated node version --- .github/workflows/release-preview.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-preview.yaml b/.github/workflows/release-preview.yaml index bb789b7..c93c471 100644 --- a/.github/workflows/release-preview.yaml +++ b/.github/workflows/release-preview.yaml @@ -5,7 +5,7 @@ on: env: SEMANTIC_RELEASE_VERSION: '24.2.0' - NODE_VERSION: '20.x' + NODE_VERSION: '20.11.0' jobs: preview: From 4747873c8f615083f83b93821ceea6fde7170c2d Mon Sep 17 00:00:00 2001 From: rahul-infra Date: Thu, 4 Dec 2025 11:01:16 +0530 Subject: [PATCH 43/43] fix: sample test. --- examples/cross-account/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/cross-account/README.md b/examples/cross-account/README.md index 70ba35e..4a809d3 100644 --- a/examples/cross-account/README.md +++ b/examples/cross-account/README.md @@ -26,7 +26,7 @@ route53:ChangeResourceRecordSets route53:ListHostedZonesByName route53:ListResourceRecordSets -And a trust policy which allows Account A to assume the role. +And a trust policy allowing Account A to assume the role. ## Example `tfvars` Configuration