feat: rasterTile support extent #370
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
# This workflow's goal is forcing an update of the reference snapshots used | |
# by Playwright tests. It runs whenever you post a new pull request comment | |
# that strictly matches the "/update-snapshots". | |
# From a high-level perspective, it works like this: | |
# 1. Because of a GitHub Action limitation, this workflow is triggered on every | |
# comment posted on a issue or pull request. We manually interrupt it unless | |
# the comment content strictly matches "/update-snapshots" and we're in a | |
# pull request. | |
# 2. Use the GitHub API to grab the information about the branch name of the current pull request. | |
# 3. Update the Playwright reference snapshots based on the UI of this branch. | |
# 4. Create the pull request into this branch. | |
name: Update Snapshots | |
on: | |
# It looks like you can't target PRs-only comments: | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_comment-use-issue_comment | |
# So we must run this workflow every time a new comment is added to issues | |
# and pull requests | |
issue_comment: | |
types: [created] | |
jobs: | |
updatesnapshots: | |
# Run this job only on comments of pull requests that strictly match | |
# the "/update-snapshots" string | |
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/update-snapshots'}} | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
# Get the branch name of the comment's pull request | |
# We must use the GitHub API to retrieve these information because they're | |
# not accessibile within workflows triggered by "issue_comment" | |
- name: Get branch name | |
id: branch_name | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const { data: pullRequest } = await github.rest.pulls.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: ${{ github.event.issue.number }}, | |
}); | |
return pullRequest.head.ref; | |
# Checkout the comment's branch | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.branch_name.outputs.result }} | |
# Setup testing environment | |
- name: Install dependencies | |
uses: ./.github/actions/prepare-install | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Playwright chromium browser | |
run: pnpm exec playwright install --with-deps chromium | |
# Update the snapshots based on the current UI | |
- name: Update snapshots | |
run: pnpm test:integration --updateSnapshot | |
# Create the pull request into branch | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: 'chore: update snapshots by CI' | |
branch: ${{ steps.branch_name.outputs.result }}-update-snapshots | |
delete-branch: true | |
title: 'chore(CI): update snapshots' | |
body: | | |
Update Snapshots | |
- Generated integration test expected images | |
- Auto-generated by [create-pull-request][1] | |
[1]: https://github.com/peter-evans/create-pull-request | |
assignees: ${{ github.event.comment.user.name }} | |
reviewers: ${{ github.event.comment.user.name }} |