Skip to content

Commit 93c8b26

Browse files
authored
Merge pull request #1 from InstaWP/fix/release-notify-first-run
Fix release-notify first-run sending huge changelog
2 parents cee51d6 + aafd5e2 commit 93c8b26

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/release-notify.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,15 @@ jobs:
5555
run: |
5656
LAST_TAG=$(git tag -l 'release-notify/*' --sort=-creatordate | head -n1)
5757
if [ -z "$LAST_TAG" ]; then
58-
echo "No previous release-notify tag found, using last 30 commits"
59-
COMMIT_LOG=$(git log --oneline --no-merges -30)
60-
DIFF_STATS=$(git diff --stat HEAD~30 HEAD 2>/dev/null || echo "Unable to get diff stats")
58+
echo "No previous release-notify tag found, using merge commit only"
59+
MERGE_SHA="${{ github.event.pull_request.merge_commit_sha }}"
60+
if [ -n "$MERGE_SHA" ]; then
61+
COMMIT_LOG=$(git log --oneline --no-merges "${MERGE_SHA}^..${MERGE_SHA}")
62+
DIFF_STATS=$(git diff --stat "${MERGE_SHA}^" "${MERGE_SHA}" 2>/dev/null || echo "Unable to get diff stats")
63+
else
64+
COMMIT_LOG=$(git log --oneline --no-merges -1)
65+
DIFF_STATS=$(git diff --stat HEAD~1 HEAD 2>/dev/null || echo "Unable to get diff stats")
66+
fi
6167
else
6268
echo "Last release-notify tag: $LAST_TAG"
6369
COMMIT_LOG=$(git log --oneline --no-merges "${LAST_TAG}..HEAD")

0 commit comments

Comments
 (0)