Skip to content

Commit 885878f

Browse files
committed
fix: update
1 parent 6733cce commit 885878f

File tree

2 files changed

+38
-56
lines changed

2 files changed

+38
-56
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ jobs:
4949
# with:
5050
# token: ${{ secrets.CODECOV_TOKEN }}
5151
# fail_ci_if_error: true
52-
VisualTest:
53-
name: Visual Regression
54-
runs-on: ubuntu-latest
55-
steps:
56-
- uses: actions/checkout@v3
57-
- name: Use Node.js
58-
uses: actions/setup-node@v3
59-
with:
60-
node-version: 20
61-
- uses: pnpm/action-setup@v2
62-
- run: pnpm install
63-
- run: npx playwright install --with-deps chromium
64-
- run: pnpm test-ct
52+
# VisualTest:
53+
# name: Visual Regression
54+
# runs-on: ubuntu-latest
55+
# steps:
56+
# - uses: actions/checkout@v3
57+
# - name: Use Node.js
58+
# uses: actions/setup-node@v3
59+
# with:
60+
# node-version: 20
61+
# - uses: pnpm/action-setup@v2
62+
# - run: pnpm install
63+
# - run: npx playwright install --with-deps chromium
64+
# - run: pnpm test-ct
6565

6666
# Lint:
6767
# runs-on: ubuntu-latest
Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,51 @@
1-
# This workflow's goal is forcing an update of the reference snapshots used
2-
# by Playwright tests. It runs whenever you post a new pull request comment
3-
# that strictly matches the "/update-snapshots".
4-
# From a high-level perspective, it works like this:
5-
# 1. Because of a GitHub Action limitation, this workflow is triggered on every
6-
# comment posted on a issue or pull request. We manually interrupt it unless
7-
# the comment content strictly matches "/update-snapshots" and we're in a
8-
# pull request.
9-
# 2. Use the GitHub API to grab the information about the branch name and SHA of
10-
# the latest commit of the current pull request.
11-
# 3. Update the Playwright reference snapshots based on the UI of this branch.
12-
# 4. Commit the newly generated Playwright reference snapshots into this branch.
131
name: Update Snapshots
14-
2+
153
on:
16-
# It looks like you can't target PRs-only comments:
17-
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_comment-use-issue_comment
18-
# So we must run this workflow every time a new comment is added to issues
19-
# and pull requests
4+
# Run any time any issue/PR has a new comment
205
issue_comment:
216
types: [created]
227

238
jobs:
24-
updatesnapshots:
25-
# Run this job only on comments of pull requests that strictly match
26-
# the "/update-snapshots" string
9+
slash_command:
10+
name: slash command
11+
# This job will only run if the comment was on a pull requests and matches the slash command
2712
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/update-snapshots'}}
13+
# Common with standard build
2814
timeout-minutes: 60
2915
runs-on: ubuntu-latest
3016
steps:
31-
# Checkout and do a deep fetch to load all commit IDs
17+
# Checkout with personal TOKEN
18+
# and hop on the PR branch
3219
- uses: actions/checkout@v3
3320
with:
34-
fetch-depth: 0 # Load all commits
35-
token: ${{ secrets.GITHUB_TOKEN }}
36-
# Get the SHA and branch name of the comment's pull request
37-
# We must use the GitHub API to retrieve these information because they're
38-
# not accessibile within workflows triggered by "issue_comment"
39-
- name: Get SHA and branch name
40-
id: get-branch-and-sha
21+
fetch-depth: 0
22+
token: ${{ secrets.GH_ACTION_TOKEN }}
23+
- name: Get Branch
24+
id: getbranch
4125
run: |
42-
sha_and_branch=$(\
26+
branch=$(\
4327
curl \
4428
-H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
4529
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }} \
46-
| jq -r '.head.sha," ",.head.ref');
47-
echo "::set-output name=sha::$(echo $sha_and_branch | cut -d " " -f 1)";
48-
echo "::set-output name=branch::$(echo $sha_and_branch | cut -d " " -f 2)"
49-
# Checkout the comment's branch
30+
| jq -r '.head.ref')
31+
echo "::set-output name=branch::$branch"
5032
- name: Fetch Branch
5133
run: git fetch
5234
- name: Checkout Branch
53-
run: git checkout ${{ steps.get-branch-and-sha.outputs.branch }}
54-
# Setup testing environment
35+
run: git checkout ${{ steps.getbranch.outputs.branch }}
36+
# Continue with standard build
5537
- name: Use Node.js
5638
uses: actions/setup-node@v3
5739
with:
5840
node-version: 20
59-
- uses: pnpm/action-setup@v2
60-
- run: pnpm install
61-
- run: npx playwright install --with-deps chromium
62-
- run: pnpm test-ct
63-
# Update the snapshots based on the current UI
41+
- name: Install dependencies
42+
run: pnpm install
43+
- name: Install Playwright
44+
run: npx playwright install --with-deps
45+
# Update the snapshots
6446
- name: Update snapshots
65-
run: pnpm test-ct --update-snapshots
66-
# Commit the changes to the pull request branch
47+
run: npx playwright test --update-snapshots --reporter=list
48+
# Commit the changes
6749
- uses: stefanzweifel/git-auto-commit-action@v4
6850
with:
69-
commit_message: "[CI] Update Snapshots"
51+
commit_message: Update Snapshots

0 commit comments

Comments
 (0)