Skip to content

Commit 47b40c2

Browse files
authored
ci: auto update sponsors in README (#613)
* ci: auto update sponsors in README * ci: auto update sponsors in README
1 parent 023b740 commit 47b40c2

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

.github/workflows/update-readme.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Data Fetch
2+
3+
on:
4+
schedule:
5+
- cron: "0 8 * * *" # Every day at 1am PDT
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-readme:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out repo
13+
uses: actions/checkout@v4
14+
with:
15+
token: ${{ secrets.WORKFLOW_PUSH_BOT_TOKEN }}
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4
19+
20+
- name: Install npm packages
21+
run: npm install --force
22+
23+
- name: Update README with latest team and sponsor data
24+
run: npm run build:readme
25+
26+
- name: Setup Git
27+
run: |
28+
git config user.name "GitHub Actions Bot"
29+
git config user.email "<[email protected]>"
30+
31+
- name: Save updated files
32+
run: |
33+
chmod +x ./tools/commit-readme.sh
34+
./tools/commit-readme.sh

tools/commit-readme.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
#------------------------------------------------------------------------------
4+
# Commits the data files if any have changed
5+
#------------------------------------------------------------------------------
6+
7+
if [ -z "$(git status --porcelain)" ]; then
8+
echo "Data did not change."
9+
else
10+
echo "Data changed!"
11+
12+
# commit the result
13+
git add README.md packages/**/README.md
14+
git commit -m "docs: Update README sponsors"
15+
16+
# push back to source control
17+
git push origin HEAD
18+
fi

0 commit comments

Comments
 (0)