Skip to content

Commit 7e8a999

Browse files
mrCherry97dbadura
andauthored
chore: Release message (#3689)
* chore: Adjust informations in changelog (#3684) * chore: Adjust informations in changelog * chore: Adjust informations in changelog * chore: Adjust informations in changelog * chore: Adjust informations in changelog * chore: Adjust informations in changelog * Chore release messegaes 2 (#3685) * chore: Adjust informations in changelog * chore: Adjust informations in changelog * Chore release messegaes 2 (#3688) * chore: Adjust informations in changelog * chore: Adjust informations in changelog * chore: Adjust informations in changelog * comment for testing * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * fix loop * add docs * add docs * uncomment needs * uncomment needs --------- Co-authored-by: Damian Badura <damian.badura@sap.com>
1 parent 17398e0 commit 7e8a999

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/scripts/create_changelog.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,33 @@ GITHUB_URL=https://api.github.com/repos/${REPOSITORY}
1414
GITHUB_AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
1515
CHANGELOG_FILE="CHANGELOG.md"
1616

17-
if [ "${PREVIOUS_RELEASE}" == "" ]
18-
then
17+
if [ -z "${PREVIOUS_RELEASE:-}" ]; then
1918
PREVIOUS_RELEASE=$(git describe --tags --abbrev=0)
2019
fi
2120
echo "Previous release: ${PREVIOUS_RELEASE}"
2221

2322
echo "## What has changed" >> ${CHANGELOG_FILE}
2423

25-
git log "${PREVIOUS_RELEASE}"..HEAD --pretty=tformat:"%h" --reverse | while read -r COMMIT
24+
NEW_FEATURES_SECTION="### New Features\n"
25+
FIXES_SECTION="### Bug Fixes\n"
26+
OTHERS_SECTION="### Others\n"
27+
28+
while read -r COMMIT;
2629
do
2730
COMMIT_AUTHOR=$(curl -H "${GITHUB_AUTH_HEADER}" -sS "${GITHUB_URL}/commits/${COMMIT}" | jq -r '.author.login')
2831
if [ "${COMMIT_AUTHOR}" != "kyma-bot" ]; then
29-
git show -s "${COMMIT}" --format="* %s by @${COMMIT_AUTHOR}" >> ${CHANGELOG_FILE}
32+
COMMIT_MESSAGE=$(git show -s "${COMMIT}" --format="%s")
33+
if [[ "${COMMIT_MESSAGE}" == feat* ]]; then
34+
NEW_FEATURES_SECTION+="* ${COMMIT_MESSAGE} by @${COMMIT_AUTHOR}\n"
35+
elif [[ "${COMMIT_MESSAGE}" == fix* ]]; then
36+
FIXES_SECTION+="* ${COMMIT_MESSAGE} by @${COMMIT_AUTHOR}\n"
37+
else
38+
OTHERS_SECTION+="* ${COMMIT_MESSAGE} by @${COMMIT_AUTHOR}\n"
39+
fi
3040
fi
31-
done
41+
done< <(git log "${PREVIOUS_RELEASE}"..HEAD --pretty=tformat:"%h" --reverse)
42+
43+
echo -e "${NEW_FEATURES_SECTION}\n${FIXES_SECTION}\n${OTHERS_SECTION}" >> ${CHANGELOG_FILE}
3244

3345
NEW_CONTRIB=$(mktemp --suffix=.new XXXXX)
3446

0 commit comments

Comments
 (0)