Skip to content

Update README with Last Update Timestamp #543

Update README with Last Update Timestamp

Update README with Last Update Timestamp #543

Workflow file for this run

name: Update README with Last Update Timestamp
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set current date and time
id: datetime
run: echo "CURRENT_DATE=$(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> $GITHUB_ENV
- name: Update README.md
run: |
# Check if the line exists and replace it, otherwise add it
if grep -q "Last updated:" README.md; then
sed -i "s|Last updated:.*|Last updated: $CURRENT_DATE|" README.md
else
echo -e "\nLast updated: $CURRENT_DATE" >> README.md
fi
- name: Commit changes
run: |
git config user.name "GitHub Action"
git config user.email "[email protected]"
git add README.md
git commit -m "Update README with last update timestamp"
git push