Skip to content

Commit a655c93

Browse files
committed
Relax post date check to allow front matter date newer than filename
Rather than requiring an exact match, only fail if the front matter date is older than the filename date, which is the case that would cause Jekyll to publish later than expected. Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Sam Barker <sam@quadrocket.co.uk>
1 parent 16304a6 commit a655c93

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/pr-build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,27 @@ jobs:
3939
CONTAINER_ENGINE: docker
4040
BUILD_IMAGE_SPEC: localhost:5000/kroxy-jekyll:latest
4141

42+
- name: Require post front matter date is not older than filename date
43+
run: |
44+
mismatches=()
45+
for post in _posts/*.md; do
46+
filename=$(basename "$post")
47+
file_date=$(echo "$filename" | grep -oP '^\d{4}-\d{2}-\d{2}')
48+
front_matter_date=$(grep -oP '^date:\s*\K\d{4}-\d{2}-\d{2}' "$post" || true)
49+
if [[ -n "$file_date" && -n "$front_matter_date" && "$front_matter_date" < "$file_date" ]]; then
50+
mismatches+=("$filename: filename date=$file_date, front matter date=$front_matter_date")
51+
fi
52+
done
53+
if [[ ${#mismatches[@]} -gt 0 ]]; then
54+
echo "Error: post front matter date is older than filename date:" >&2
55+
for mismatch in "${mismatches[@]}"; do
56+
echo " $mismatch" >&2
57+
done
58+
exit 1
59+
else
60+
echo "Success: all post front matter dates are consistent with filename dates"
61+
fi
62+
4263
# Currently the image shas are not available when we create the release, they need to be manually
4364
# updated in the release PR before merge.
4465
- name: Require release manifests to contain non-placeholder container image SHAs

0 commit comments

Comments
 (0)