Update README #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update README | |
on: | |
workflow_dispatch: | |
push: | |
schedule: | |
# run at 10am UTC every Sunday. | |
- cron: '0 10 * * 0' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Install npm dependencies | |
run: npm install | |
- name: Run eslint | |
run: npm run lint | |
update: | |
if: ${{ github.event_name == 'schedule' || | |
github.event_name == 'workflow_dispatch' }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Install npm dependencies | |
run: npm install | |
- name: Update README | |
env: | |
GH_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npm run update-readme | |
- name: Setup git config | |
run: | | |
# Setup the username and email. Use 'GitHub Actions Bot' with no email | |
# by default | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
- name: Commit | |
run: | | |
if [[ -n $(git status -s) ]]; then | |
# If changes exist, stage the file, commit and push | |
git add README.md | |
git commit -m "Update README.md." | |
git push origin main | |
else | |
# No changes, skip commit and push. | |
echo "No changes to commit. Skipping commit and push." | |
fi |