forked from Bullrich/generate-release-changelog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·34 lines (26 loc) · 1.27 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh -l
git clone --quiet https://github.com/$REPO &> /dev/null
git config --global --add safe.directory /github/workspace
tag=$(git tag --sort version:refname | tail -n 2 | head -n 1)
tags=$(git tag --sort version:refname | tail -n 6)
if [ "$tag" ]; then
echo "Tags list is ${tags}"
echo "Previous tag is ${tag}"
changelog=$(git log --pretty=format:":white_check_mark: %C(yellow)%h%Creset %ad [%an]:\n%B" --date=short $tag..HEAD)
slackchangelog=$(git log --pretty=format:":white_check_mark: %ad [%an]:\n%B" --date=short $tag..HEAD)
else
echo "Previous tag is empty"
changelog=$(git log --pretty=format:":white_check_mark: %C(yellow)%h%Creset %ad [%an]:\n%B" --date=short)
slackchangelog=$(git log --pretty=format:":white_check_mark: %ad [%an]:\n%B" --date=short)
fi
echo "Changelog is ### ${changelog}"
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
changelog=" - ${changelog//$'\r'/'%0D'}"
slackchangelog="${slackchangelog//'%'/'%25'}"
slackchangelog="${slackchangelog//$'\n'/'%0A'}"
slackchangelog=" - ${slackchangelog//$'\r'/'%0D'}"
echo "::set-output name=changelog::$changelog"
echo "::set-output name=slackchangelog::$slackchangelog"
# echo "changelog=$changelog" >> $GITHUB_OUTPUT
# echo "slackchangelog=$slackchangelog" >> $GITHUB_OUTPUT