-
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (46 loc) · 1.54 KB
/
Copy pathscreenshot.yml
File metadata and controls
58 lines (46 loc) · 1.54 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Update screenshot
on:
schedule:
# Sunday at 22:00 UTC+7.
# GitHub Actions cron uses UTC, so this runs Sunday at 15:00 UTC.
- cron: "0 15 * * 0"
workflow_dispatch:
permissions:
contents: write
jobs:
screenshot:
name: Create and commit screenshot
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: 25
cache: npm
- name: Install dependencies
run: npm ci
- name: Run screenshot script
run: npm run screenshot
- name: Verify screenshot exists
run: test -f .github/screenshot.png
- name: Commit screenshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
REF_NAME: ${{ github.ref_name }}
run: |
git config user.name "davidsneighbour"
git config user.email "davidsneighbour@users.noreply.github.com"
git add .github/screenshot.png
if git diff --cached --quiet; then
echo "No screenshot changes to commit."
exit 0
fi
git commit -m "chore: update screenshot"
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${REPOSITORY}.git" \
"HEAD:refs/heads/${REF_NAME}"