aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow/assert-changelog.sh
blob: bef610bb3dade95f7f118df3b3ad00e7046328a4 (about) (plain) (blame)
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
#!/bin/sh
set -eu

PROJECT="$1"
shift

assert() {
	DATE="$1"
	VVERSION="$2"
	VERSION="${2#v}"
	CHANGELOG_ENTRY="# [$VERSION](https://git.euandreh.xyz/$PROJECT/commit/?id=$VVERSION) - $DATE"

	if ! grep -qF "$CHANGELOG_ENTRY" CHANGELOG.md; then
		echo "Missing '$CHANGELOG_ENTRY' entry from CHANGELOG.md" >&2
		exit 1
	fi
}

for VVERSION in $(git tag); do
	DATE="$(git log -1 --format=%cd --date=short "$VVERSION")"
	assert "$DATE" "$VVERSION"
done

# "$@" represents a list of tags to be also included in the verification.
# shellcheck disable=2068
for VVERSION in $@; do
	DATE="$(date '+%Y-%m-%d')"
	assert "$DATE" "$VVERSION"
done