-
Notifications
You must be signed in to change notification settings - Fork 7
39 lines (34 loc) · 1.15 KB
/
update-readme.yaml
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
38
39
name: automation
on:
workflow_dispatch:
# Run weekly at 11:45 UTC Wednesday.
schedule:
- cron: '45 11 * * 3'
jobs:
# Updates the timestamp in README.md, which triggers a "push" event.
bump_timestamp:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set update date variable
run: |
UPDATE_DATE=$(date)
echo "UPDATE_DATE=${UPDATE_DATE}" >> $GITHUB_ENV
- name: Update last sync date to launchpad
env:
BEGIN_TAG: "<!-- BEGIN SYNC INFO -->"
END_TAG: "<!-- END SYNC INFO -->"
run: |
UPDATE=$(cat README.md | perl -0777 -pe 's#(${{ env.BEGIN_TAG }})(?:.|\n)*?(${{ env.END_TAG }})#${1}\nLast sync to launchpad: ${{ env.UPDATE_DATE }}\n${2}#g')
echo "${UPDATE}" > README.md
- uses: EndBug/add-and-commit@v9
with:
message: "bump timestamp"
default_author: github_actions
call-sync-repo:
uses: ./.github/workflows/sync-repo.yaml
secrets:
GIT_SSH_PRIVATE_KEY: ${{ secrets.GIT_SSH_PRIVATE_KEY }}
GIT_SSH_KNOWN_HOSTS: ${{ secrets.GIT_SSH_KNOWN_HOSTS }}