Repository navigation
59 lines (55 loc) · 1.84 KB
/
Copy pathreadme.yml
File metadata and controls
59 lines (55 loc) · 1.84 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
59
name: 📃 Readme summary
on:
push:
branches: [main]
paths:
- 'data/**'
- 'scripts/readme-insert.ts'
- 'src/lib/**'
schedule:
- cron: '17 6 * * *'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: readme
cancel-in-progress: false
jobs:
update:
name: 📃 Fill in the README
runs-on: ubuntu-latest
permissions:
contents: write
env:
HAS_BOT: ${{ secrets.BOT_PRIVATE_KEY != '' }}
steps:
- uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
id: bot
if: env.HAS_BOT == 'true'
with:
client-id: Iv23liPIG7E12UlaQMaD
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
permission-contents: write
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: main
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
package-manager-cache: false
- run: npm ci
- run: npm run -s readme >> "$GITHUB_STEP_SUMMARY"
- name: Commit it to main
env:
GH_TOKEN: ${{ steps.bot.outputs.token || github.token }}
run: |
if git diff --quiet -- .github/README.md; then
echo "Nothing's changed since the last update" >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
base64 -w0 .github/README.md > "$RUNNER_TEMP/readme"
gh api -X PUT "repos/$GITHUB_REPOSITORY/contents/.github/README.md" \
-f message='docs: update the readme summary' -f branch=main \
-f sha="$(git rev-parse HEAD:.github/README.md)" -F content=@"$RUNNER_TEMP/readme" \
--jq '"✅ Committed [\(.commit.sha[:7])](\(.commit.html_url))"' >> "$GITHUB_STEP_SUMMARY"