daml/ci/check-changelog.sh
Gary Verhaegen a1fab2d9af
enable patch releases (#5584)
This commit aims at enabling future patch releases; it is the
master-branch equivalent of #5569 (applied to the 1.0 release branch).

The only change between the two changelogs should be that this one also
changes the docs cron so it can find the trigger commits for patch
releases.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-16 17:50:55 +02:00

35 lines
859 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
contains_changelog () {
local awk_script="
BEGIN { flag = 0 }
toupper(\$0) ~ /CHANGELOG_BEGIN/ && flag == 0 { flag = 1 }
toupper(\$0) ~ /CHANGELOG_END/ && flag == 1 { flag = 2 }
END { print flag }
"
[[ 2 == $(git show -s --format=%B $1 | awk "$awk_script") ]]
}
for sha in $(git rev-list ${1:-origin/master}..); do
if contains_changelog $sha; then
echo "Commit $sha contains a changelog entry."
exit 0
fi
done
echo "
No changelog entry found; please add one. If your PR does not need a
changelog entry, please add an explicit, empty one, i.e. add
CHANGELOG_BEGIN
CHANGELOG_END
to your commit message.
"
exit 1