From aafd5e2ae7e85f41360d3437ae54b5c9ea012341 Mon Sep 17 00:00:00 2001 From: Vikas Singhal Date: Mon, 9 Mar 2026 21:01:30 +0530 Subject: [PATCH] fix: scope release-notify first-run to merge commit only When no release-notify tag exists (first run), the fallback grabbed the last 30 commits instead of just the merged PR's changes, causing a huge changelog in the Slack notification. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/release-notify.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-notify.yml b/.github/workflows/release-notify.yml index a73031e..6defa6b 100644 --- a/.github/workflows/release-notify.yml +++ b/.github/workflows/release-notify.yml @@ -55,9 +55,15 @@ jobs: run: | LAST_TAG=$(git tag -l 'release-notify/*' --sort=-creatordate | head -n1) if [ -z "$LAST_TAG" ]; then - echo "No previous release-notify tag found, using last 30 commits" - COMMIT_LOG=$(git log --oneline --no-merges -30) - DIFF_STATS=$(git diff --stat HEAD~30 HEAD 2>/dev/null || echo "Unable to get diff stats") + echo "No previous release-notify tag found, using merge commit only" + MERGE_SHA="${{ github.event.pull_request.merge_commit_sha }}" + if [ -n "$MERGE_SHA" ]; then + COMMIT_LOG=$(git log --oneline --no-merges "${MERGE_SHA}^..${MERGE_SHA}") + DIFF_STATS=$(git diff --stat "${MERGE_SHA}^" "${MERGE_SHA}" 2>/dev/null || echo "Unable to get diff stats") + else + COMMIT_LOG=$(git log --oneline --no-merges -1) + DIFF_STATS=$(git diff --stat HEAD~1 HEAD 2>/dev/null || echo "Unable to get diff stats") + fi else echo "Last release-notify tag: $LAST_TAG" COMMIT_LOG=$(git log --oneline --no-merges "${LAST_TAG}..HEAD")