Skip to content

Commit 0003250

Browse files
committed
feat(release workflow): make changelog range clickable link to diffs
1 parent 08bb6e7 commit 0003250

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,22 @@ jobs:
4040
repo_url="https://github.com/${{ github.repository }}"
4141
git fetch --prune --unshallow
4242
previous_tag=$(git tag --sort=-creatordate | head -n 1)
43+
current_sha=$(git rev-parse HEAD)
4344
if [ -z "$previous_tag" ]; then
4445
range=""
46+
compare_url="${repo_url}/commit/${current_sha}"
47+
changelog="Commit changes for [HEAD](${compare_url}):"$'\n'
48+
log_range="HEAD"
4549
else
46-
range="$previous_tag..HEAD"
50+
range="${previous_tag}..${current_sha}"
51+
display_range="${previous_tag}..HEAD"
52+
compare_url="${repo_url}/compare/${previous_tag}...${current_sha}"
53+
changelog="Commit changes for [${display_range}](${compare_url}):"$'\n'
54+
log_range="${previous_tag}..${current_sha}"
4755
fi
48-
changelog="Commit changes for **$range**:"$'\n'
4956
while read -r hash message; do
5057
changelog="${changelog}* [${message}](${repo_url}/commit/${hash})"$'\n'
51-
done < <(git log $range --pretty=format:"%H %s"; echo "")
58+
done < <(git log ${log_range} --pretty=format:"%H %s"; echo "")
5259
echo "changelog<<EOF" >> $GITHUB_OUTPUT
5360
echo "$changelog" >> $GITHUB_OUTPUT
5461
echo "EOF" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)