#!/bin/sh
set -eu

PROJECT="$1"

for VVERSION in $(git tag); do
	VERSION="${VVERSION#v}"
	DATE="$(git log -1 --format=%cd --date=short "$VVERSION")"
	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
done
