Skip to content

Update Fixtures From Google Docs #87

Update Fixtures From Google Docs

Update Fixtures From Google Docs #87

Workflow file for this run

on:
workflow_dispatch: {}
schedule:
- cron: '0 17 * * 2' # Noon Pacific on Tuesdays
name: Update Fixtures From Google Docs
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Install dependencies
run: npm ci
- name: Install browsers
run: npx playwright install chromium
- name: Download Fixtures
run: npm run download-fixtures
# Check whether the fixtures changed.
# The create-pull-request action automatically detects changes, but we
# have an issue where the "*.export.html" fixtures erroneously change
# even when the change is not meaningful. The other ones are stable,
# though, so we use them as an indicator about whether there were changes
# worth committing.
- id: detect_updates
run: |
echo 'Git changes:'
# FIXME: just for testing! DO NOT MERGE TO MAIN
# if git status -s | grep --invert '^ M test/fixtures/.*\.export\.html'; then
# echo 'Copy fixtures were changed'
# echo 'copy_fixtures_changed=true' >> "${GITHUB_OUTPUT}"
# else
# echo 'Copy fixtures not changed'
# echo 'copy_fixtures_changed=' >> "${GITHUB_OUTPUT}"
# fi
echo 'copy_fixtures_changed=true' >> "${GITHUB_OUTPUT}"
- name: Generate commit/PR token
if: ${{ steps.detect_updates.outputs.copy_fixtures_changed == 'true' }}
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.FIXTURE_PR_APP_ID }}
private-key: ${{ secrets.FIXTURE_PR_APP_PRIVATE_KEY }}
- name: Create PR
if: ${{ steps.detect_updates.outputs.copy_fixtures_changed == 'true' }}
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.generate-token.outputs.token }}
sign-commits: true
branch: 'auto/fixture-update'
delete-branch: true
commit-message: 'Automated fixture update from Google Docs'
title: 'Update Fixtures'