Skip to content

Commit 893dbe6

Browse files
committed
chore: added auto approve snapshots workflow (#DS-3875)
1 parent 7b0d457 commit 893dbe6

3 files changed

Lines changed: 65 additions & 53 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: E2E approve snapshots
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
approve_snapshots:
13+
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/approve-snapshots') }}
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 10
16+
steps:
17+
- uses: xt0rted/pull-request-comment-branch@v2
18+
id: comment-branch
19+
- uses: actions/checkout@v4
20+
with:
21+
ref: ${{ steps.comment-branch.outputs.head_ref }}
22+
- uses: thollander/actions-comment-pull-request@v3
23+
with:
24+
message: 🔄 [Updating](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) snapshots.
25+
- uses: ./.github/actions/setup-node
26+
- run: yarn run e2e:setup
27+
- run: |
28+
yarn run e2e:components --update-snapshots
29+
- uses: stefanzweifel/git-auto-commit-action@v5
30+
id: commit-and-push
31+
with:
32+
commit_message: 'test: updated e2e snapshots'
33+
file_pattern: '**/*.png'
34+
- uses: thollander/actions-comment-pull-request@v3
35+
if: ${{ steps.commit-and-push.outputs.changes_detected == 'true' }}
36+
with:
37+
message: ✅ Snapshots [updated](https://github.com/${{ github.repository }}/pull/${{ github.event.issue.number }}/commits/${{ steps.commit-and-push.outputs.commit_hash }})!
38+
- uses: thollander/actions-comment-pull-request@v3
39+
if: ${{ steps.commit-and-push.outputs.changes_detected != 'true' }}
40+
with:
41+
message: ⚠️ No snapshots changes detected.

.github/workflows/e2e-update-screenshots.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/e2e.yml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,36 @@ on:
66
- main
77
pull_request:
88

9-
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
11-
cancel-in-progress: true
9+
permissions:
10+
contents: write
11+
pull-requests: write
1212

1313
jobs:
14-
test:
14+
tests:
1515
runs-on: ubuntu-latest
1616
timeout-minutes: 10
1717
steps:
18-
- name: Checkout repository
19-
uses: actions/checkout@v4
20-
21-
- name: Setup Node
22-
uses: ./.github/workflows/actions/setup-node
23-
24-
- name: Setup test environment
25-
run: yarn run e2e:setup
26-
27-
- name: Run e2e tests
28-
run: yarn run e2e:components
29-
18+
- uses: actions/checkout@v4
19+
- uses: ./.github/actions/setup-node
20+
- run: yarn run e2e:setup
21+
- id: run-e2e-tests
22+
run: |
23+
yarn run e2e:components
3024
- uses: actions/upload-artifact@v4
31-
if: ${{ !cancelled() }}
25+
if: ${{ always() }}
26+
id: upload-report
3227
with:
3328
name: playwright-report
3429
path: playwright-report/
35-
retention-days: 1
30+
retention-days: 5
31+
- uses: thollander/actions-comment-pull-request@v3
32+
if: ${{ failure() && steps.run-e2e-tests.outcome == 'failure' }}
33+
with:
34+
message: |
35+
### 🚨 E2E tests failed
36+
37+
Review the [report](${{ steps.upload-report.outputs.artifact-url }}) for details.
38+
39+
---
40+
41+
💡 Comment `/approve-snapshots` to approve snapshot changes.

0 commit comments

Comments
 (0)