|
|
@@ -0,0 +1,49 @@
|
|
|
+name: Docs Last Updated
|
|
|
+
|
|
|
+on:
|
|
|
+ push:
|
|
|
+ branches: [dev]
|
|
|
+ paths:
|
|
|
+ - "docs/**"
|
|
|
+ - "README.md"
|
|
|
+ workflow_dispatch:
|
|
|
+
|
|
|
+permissions:
|
|
|
+ contents: write
|
|
|
+
|
|
|
+jobs:
|
|
|
+ stamp:
|
|
|
+ if: github.actor != 'github-actions[bot]'
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+ steps:
|
|
|
+ - uses: actions/checkout@v4
|
|
|
+ with:
|
|
|
+ fetch-depth: 0
|
|
|
+ token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
+
|
|
|
+ - name: Update Last updated date
|
|
|
+ run: |
|
|
|
+ TODAY=$(date -u +%Y-%m-%d)
|
|
|
+ echo "Today: $TODAY"
|
|
|
+ changed=0
|
|
|
+ for f in docs/*.md; do
|
|
|
+ [ -f "$f" ] || continue
|
|
|
+ if grep -q "Last updated" "$f"; then
|
|
|
+ # replace any *Last updated: YYYY-MM-DD* or *Last updated: YYYY-MM-DD.* line
|
|
|
+ sed -i -E "s/\\*Last updated: [0-9]{4}-[0-9]{2}-[0-9]{2}\\.?\\*/\\*Last updated: $TODAY.\\*/g" "$f"
|
|
|
+ # also handle bare *Last updated: YYYY-MM-DD* without trailing period inside italics
|
|
|
+ sed -i -E "s/\\*Last updated: [0-9]{4}-[0-9]{2}-[0-9]{2}\\*/\\*Last updated: $TODAY.\\*/g" "$f"
|
|
|
+ fi
|
|
|
+ done
|
|
|
+ git diff --quiet && echo "no doc date changes" && exit 0
|
|
|
+ git diff --stat
|
|
|
+ git config user.name "github-actions[bot]"
|
|
|
+ git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
+ git add docs/*.md
|
|
|
+ # only commit if staged changes exist
|
|
|
+ git diff --cached --quiet && exit 0
|
|
|
+ git commit -m "docs: bump Last updated to $TODAY [skip ci]"
|
|
|
+ git push
|
|
|
+
|
|
|
+ - name: Summary
|
|
|
+ run: echo "Last updated stamp checked"
|