aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow/assert-changelog.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-06-16 23:00:20 -0300
committerEuAndreh <eu@euandre.org>2021-06-16 23:00:20 -0300
commit993e0e15eb9691bc73e502e0003fa799650862e3 (patch)
treefbba2173783f55445ddd7c7e24f652db6936016d /aux/workflow/assert-changelog.sh
parentREADME.md: Highlight link as anchor instead of text (diff)
downloadpackage-repository-993e0e15eb9691bc73e502e0003fa799650862e3.tar.gz
package-repository-993e0e15eb9691bc73e502e0003fa799650862e3.tar.xz
aux/: Update
Diffstat (limited to '')
-rwxr-xr-xaux/workflow/assert-changelog.sh30
1 files changed, 27 insertions, 3 deletions
diff --git a/aux/workflow/assert-changelog.sh b/aux/workflow/assert-changelog.sh
index 8e81f1f..dc8867f 100755
--- a/aux/workflow/assert-changelog.sh
+++ b/aux/workflow/assert-changelog.sh
@@ -1,14 +1,38 @@
#!/bin/sh
set -eu
+TLD="$(cat aux/tld.txt)"
PROJECT="$1"
+shift
-for VVERSION in $(git tag); do
- VERSION="${VVERSION#v}"
- DATE="$(git log -1 --format=%cd --date=short "$VVERSION")"
+HOMEPAGE_LINK="Changelog for [$PROJECT](https://$TLD/$PROJECT/)."
+
+if ! grep -qF "$HOMEPAGE_LINK" CHANGELOG.md; then
+ echo "Missing link to homepage in CHANGELOG.md:" >&2
+ echo "$HOMEPAGE_LINK"
+ exit 1
+fi
+
+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