Auto-Update “Last Updated” Date in README on Every GitHub Push

Published: (January 13, 2026 at 03:01 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for Auto-Update “Last Updated” Date in README on Every GitHub Push

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)

  1. Go to Repo → Settings → Actions → General.
  2. Under Workflow permissions, select Read and write permissions.
  3. 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.
Back to Blog

Related posts

Read more »

I hate Github Actions with Passion

markdown !Alexander Przemysław Kamińskihttps://media2.dev.to/dynamic/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3...