-
Notifications
You must be signed in to change notification settings - Fork 151
37 lines (30 loc) · 1.01 KB
/
refresh-readme.yml
File metadata and controls
37 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Refresh README Timestamp
on:
workflow_dispatch:
permissions:
contents: write
jobs:
refresh-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: main
- name: Update README timestamp
run: |
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
if grep -q "<!-- Last updated:" README.md; then
sed -i "s/<!-- Last updated:.*-->/<!-- Last updated: $TIMESTAMP -->/" README.md
else
echo "<!-- Last updated: $TIMESTAMP -->" | cat - README.md > /tmp/README.tmp
mv /tmp/README.tmp README.md
fi
- name: Commit updated README
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "chore: update README timestamp" || echo "No changes to commit"
- name: Push changes
run: git push origin main