Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: auto update sponsors in README #613

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/update-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Data Fetch

on:
schedule:
- cron: "0 8 * * *" # Every day at 1am PDT
workflow_dispatch:

jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
token: ${{ secrets.WORKFLOW_PUSH_BOT_TOKEN }}

- name: Set up Node.js
uses: actions/setup-node@v4

- name: Install npm packages
run: npm install --force

- name: Update README with latest team and sponsor data
run: npm run build:readme

- name: Setup Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<[email protected]>"

- name: Save updated files
run: |
chmod +x ./tools/commit-readme.sh
./tools/commit-readme.sh
18 changes: 18 additions & 0 deletions tools/commit-readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

#------------------------------------------------------------------------------
# Commits the data files if any have changed
#------------------------------------------------------------------------------

if [ -z "$(git status --porcelain)" ]; then
echo "Data did not change."
else
echo "Data changed!"

# commit the result
git add README.md packages/**/README.md
git commit -m "docs: Update README sponsors"

# push back to source control
git push origin HEAD
fi