Skip to content

Update Snapshots

Update Snapshots #15

name: Update Snapshots
on:
workflow_dispatch:
permissions:
contents: write # required for push commit
pull-requests: write # required for create pr
env:
GH_TOKEN: ${{ github.token }}
jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: setup node env
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'yarn'
- run: yarn --immutable
- run: yarn update-known-good
- 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 --global user.name 'github-actions[bot]'`)
await exec.exec(`git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'"`)
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\n\nClose and reopen this PR to trigger CI.',
})