Update Markdown Date #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Markdown Date | |
| on: | |
| schedule: | |
| - cron: '0 4 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-date: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Update README dates | |
| run: | | |
| today="$(date -u +%Y-%m-%d)" | |
| if [[ ! -f README.md ]]; then | |
| echo "README.md not found; nothing to update" | |
| exit 0 | |
| fi | |
| sed -E -i "s/^Last updated: .*/Last updated: ${today}/" README.md | |
| - name: Commit date changes | |
| run: | | |
| if git diff --quiet; then | |
| echo "No date change required" | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add README.md | |
| git commit -m "docs: update last updated date" | |
| git push |