Skip to content

Update library

Update library #833

name: Update library
on:
push:
branches:
- gh-pages
schedule:
- cron: "30 5 * * *"
workflow_dispatch:
jobs:
update_library:
runs-on: macOS-latest
name: Update library
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install @actions/core node-fetch
- name: Update library
run: node .github/actions/update-library.mjs
id: update
env:
GoogleToken: ${{ secrets.GoogleToken }}
- run: npm run build
- run: npm run test -- -u
- name: Commit files
if: env.UpdatedLibrary == 'true' && env.AutoTag != 'true'
run: |
git pull
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A && git commit -m "${{ env.LibraryCommitMessage }}"
git push
- name: Create pull request when an auto-tag occurs
if: env.UpdatedLibrary == 'true' && env.AutoTag == 'true'
run: |
git config pull.rebase true
git fetch origin
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git checkout -b review-tags-${{ github.run_id }}
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git add -A && git commit -m "Review auto-tag" -m "${{ env.LibraryCommitMessage }}"
git push --set-upstream origin review-tags-${{ github.run_id }}
gh pr create -B gh-pages -H "review-tags-${{ github.run_id }}" --fill
env:
GH_TOKEN: ${{ github.token }}
- name: Repository Dispatch
if: env.UpdatedLibrary == 'true' && env.AutoTag != 'true'
uses: peter-evans/repository-dispatch@v3
with:
event-type: trigger-deploy