Skip to content

Commit

Permalink
revert breaking changes to create_changelog.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
friedrichwilken committed Feb 8, 2024
1 parent 76254ab commit ae078f4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions hack/scripts/create_changelog.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
#!/usr/bin/env bash

# Optional args need to be handled before 'set -o nonset'.
PREVIOUS_RELEASE=$3 # for testability

# Error handling.
set -o nounset # treat unset variables as an error and exit immediately.
set -o errexit # exit immediately when a command fails.
set -E # needs to be set if we want the ERR trap
set -o pipefail # prevents errors in a pipeline from being masked

RELEASE_TAG=$1
REPOSITORY=$2

REPOSITORY=${REPOSITORY:-kyma-project/eventing-manager}
GITHUB_URL=https://api.github.com/repos/${REPOSITORY}
GITHUB_AUTH_HEADER="Authorization: token ${GH_TOKEN}"
CHANGELOG_FILE="CHANGELOG.md"

# The git describe --tag --abbrev=0 command is used to find the most recent tag that is reachable from a commit.
# The --tag option tells git describe to consider any tag found in the refs/tags namespace, enabling matching a lightweight (non-annotated) tag.
PREVIOUS_RELEASE=$(git describe --tags --abbrev=0)
# If the previous release was not passed, we will
if [ "${PREVIOUS_RELEASE}" == "" ]; then
# The git describe --tag --abbrev=0 command is used to find the most recent tag that is reachable from a commit.
# The --tag option tells git describe to consider any tag found in the refs/tags namespace, enabling matching a lightweight (non-annotated) tag.
PREVIOUS_RELEASE=$(git describe --tags --abbrev=0)
fi

# Generate the changelog in the CHANGELOG.md.
echo "## What has changed" >>${CHANGELOG_FILE}
Expand All @@ -30,7 +36,7 @@ git log "${PREVIOUS_RELEASE}"..HEAD --pretty=tformat:"%h" --reverse | while read
done

# Create a new contibutors file (with a unique name based on the process ID of the current shell).
NEW_CONTRIB=$$.authors
NEW_CONTRIB=$$.new

# Find unique authors who contributed since the last release, but not before it, and add them to the NEW_CONTRIB file.
join -v2 \
Expand All @@ -51,3 +57,6 @@ fi

# Append link to the full-changelog this changelog.
echo -e "\n**Full changelog**: https://github.com/$REPOSITORY/compare/${PREVIOUS_RELEASE}...${RELEASE_TAG}" >>${CHANGELOG_FILE}

# Cleanup the NEW_CONTRIB file.
rm ${NEW_CONTRIB} || true

0 comments on commit ae078f4

Please sign in to comment.