Skip to content

Commit c12f0a9

Browse files
committed
Warn in job summary when future-dated posts are deployed
When a push to main includes future-dated posts, the deploy workflow now adds a warning to the GitHub Actions job summary listing the affected posts and their publish dates, with a reminder to re-run the workflow manually on the publish date. Both the filename date and front matter date are checked, using whichever is later. Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Sam Barker <sam@quadrocket.co.uk>
1 parent 8910f01 commit c12f0a9

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

.github/workflows/jekyll-gh-pages.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,34 @@ jobs:
7070
CONTAINER_ENGINE: docker
7171
CONFIG_OVERRIDES: _config-overrides.yml
7272
BUILD_IMAGE_SPEC: localhost:5000/kroxy-jekyll:latest
73+
- name: Warn about future-dated posts
74+
run: |
75+
today=$(date -u +%Y-%m-%d)
76+
future_posts=()
77+
for post in _posts/*.md; do
78+
filename=$(basename "$post")
79+
file_date=$(echo "$filename" | grep -oP '^\d{4}-\d{2}-\d{2}')
80+
front_matter_date=$(grep -oP '^date:\s*\K\d{4}-\d{2}-\d{2}' "$post" || true)
81+
# Use whichever date is later
82+
if [[ -n "$front_matter_date" && "$front_matter_date" > "$file_date" ]]; then
83+
post_date="$front_matter_date"
84+
else
85+
post_date="$file_date"
86+
fi
87+
if [[ -n "$post_date" && "$post_date" > "$today" ]]; then
88+
future_posts+=("$filename (publishes $post_date)")
89+
fi
90+
done
91+
if [[ ${#future_posts[@]} -gt 0 ]]; then
92+
echo "## ⚠️ Future-dated posts detected" >> "$GITHUB_STEP_SUMMARY"
93+
echo "The following posts will not appear until the site is rebuilt on or after their publish date:" >> "$GITHUB_STEP_SUMMARY"
94+
for post in "${future_posts[@]}"; do
95+
echo "- $post" >> "$GITHUB_STEP_SUMMARY"
96+
done
97+
echo "" >> "$GITHUB_STEP_SUMMARY"
98+
echo "Re-run this workflow manually on the publish date to make them live." >> "$GITHUB_STEP_SUMMARY"
99+
fi
100+
73101
- name: Upload artifact
74102
# Automatically uploads an artifact from the './_site' directory by default
75103
uses: actions/upload-pages-artifact@v3

0 commit comments

Comments
 (0)