-
Notifications
You must be signed in to change notification settings - Fork 12
35 lines (29 loc) · 1.06 KB
/
update-readme.yml
File metadata and controls
35 lines (29 loc) · 1.06 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
name: Update Date in README Title
on:
schedule:
- cron: '0 0 * * 6' # Runs every Saturday at midnight UTC
workflow_dispatch: # Allows you to run this workflow manually
jobs:
update-readme:
runs-on: ubuntu-latest
# This is the new block that fixes the permission error
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Update date in README
run: |
sed -i "s/\[.*Latest Project\]/\[$(date +'%d %b %Y') Latest Project\]/" Readme.md
- name: Commit and push if changed
run: |
if ! git diff --quiet Readme.md; then
echo "Readme.md has been updated. Committing changes."
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add Readme.md
git commit -m "docs: Updated Project List"
git push
else
echo "No changes to commit. Readme.md is up-to-date."
fi