Update Snapshots #89
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 Snapshots | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write # required for push commit | |
pull-requests: write # required for create pr | |
env: | |
DB_PATH: ./db.sqlite | |
GH_TOKEN: ${{ github.token }} | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: Setup yarn | |
run: npm install -g yarn | |
- name: setup node env | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: 'yarn' | |
- run: yarn --immutable | |
- run: yarn update-env | |
- run: yarn test -u | |
- name: Commit and Create PR | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const branchName = `update-snapshots-${context.sha.slice(0, 7)}` | |
await exec.exec(`git config user.email "[email protected]"`) | |
await exec.exec(`git config user.name "Acala Github Action Bot"`) | |
await exec.exec(`git checkout -b ${branchName}`) | |
await exec.exec(`git`, ['commit', '-am', 'update snapshots']) | |
await exec.exec(`git push origin HEAD:${branchName}`) | |
await github.rest.pulls.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: 'Update snapshots', | |
head: branchName, | |
base: 'master', | |
body: 'Update snapshots', | |
}) |