Auto-Update “Last Updated” Date in README on Every GitHub Push
Source: Dev.to

Auto-Update “Last Updated” Date on GitHub Push
This guide shows how to automatically update a Last updated date in your README.md every time you push code to GitHub — using GitHub Actions.
Why This Is Needed
GitHub does not automatically modify file contents on push.
If you want a line like:
_Last updated: 2026-01-14_
to stay current, you need automation.
Final Result
After setup:
- Every push triggers a GitHub Action.
- The README date updates automatically.
- A commit is created by
github-actions. - No manual edits required.
Step 1️⃣ Add a Placeholder in README
In your README.md (must be at the repo root) add:
_Last updated: AUTO_
⚠️ This line must match exactly (case‑sensitive).
Step 2️⃣ Create the GitHub Actions Folder
Create this structure in your repository:
.github/
└── workflows/
Step 3️⃣ Create the Workflow File
Create the file:
.github/workflows/update-date.yml
Paste the following content:
name: Update README date
on:
push:
branches:
- main
- master
jobs:
update-date:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: true
- name: Update date
run: |
DATE=$(date +"%Y-%m-%d")
sed -i "s/_Last updated:.*_/_Last updated: ${DATE}_/" README.md
- name: Commit and push
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add README.md
git commit -m "chore: auto update last updated date" || echo "No changes"
git push
Step 4️⃣ Enable Workflow Permissions (Very Important)
- Go to Repo → Settings → Actions → General.
- Under Workflow permissions, select Read and write permissions.
- Click Save.
Without this, the workflow will fail silently.
Step 5️⃣ Trigger the Workflow
The workflow runs only on new pushes. Make a small change and push:
git add README.md
git commit -m "trigger workflow"
git push
Step 6️⃣ Verify
- Open the Actions tab in your repository.
- Open the latest workflow run and ensure all steps are green.
- Check
README.md; you should now see something like:
_Last updated: 2026-01-14_
TL;DR
- GitHub doesn’t auto‑update files.
- GitHub Actions can.
- A small workflow keeps your README date accurate.
- Zero manual effort after setup.