Skip to content

Commit 4fc8fe7

Browse files
authored
Playwright fix action for forks (#165)
1 parent 6c05ace commit 4fc8fe7

File tree

2 files changed

+46
-17
lines changed

2 files changed

+46
-17
lines changed

.github/workflows/playwright.yml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Playwright Tests
22

33
on:
4-
# push:
5-
# branches: [main, next]
64
pull_request:
75

86
jobs:
@@ -29,20 +27,13 @@ jobs:
2927
name: playwright-report
3028
path: ./playwright-report
3129
retention-days: 1
32-
- name: Upload Playwright report
33-
if: always()
34-
env:
35-
AWS_ACCESS_KEY_ID: ${{ secrets.STORYBOOK_S3_KEY_ID }}
36-
AWS_SECRET_ACCESS_KEY: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
37-
AWS_DEFAULT_REGION: ru-central1
38-
AWS_EC2_METADATA_DISABLED: true
39-
run: aws s3 cp ./playwright-report s3://playwright-reports/dynamic-forms/pulls/${{ github.event.pull_request.number }}/ --endpoint-url=https://storage.yandexcloud.net --recursive
30+
- name: Save PR ID
31+
run: |
32+
pr="${{ github.event.pull_request.number }}"
33+
echo $pr > ./pr-id.txt
4034
shell: bash
41-
- name: Create Comment
42-
if: always()
43-
uses: marocchino/sticky-pull-request-comment@v2
35+
- name: Create PR Artifact
36+
uses: actions/upload-artifact@v3
4437
with:
45-
GITHUB_TOKEN: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
46-
number: ${{ github.event.pull_request.number }}
47-
header: playwright test
48-
message: '[Playwright Test Component](https://storage.yandexcloud.net/playwright-reports/dynamic-forms/pulls/${{ github.event.pull_request.number }}/index.html) is ready.'
38+
name: pr
39+
path: ./pr-id.txt
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: PR Playwright Report
2+
3+
on:
4+
workflow_run:
5+
workflows: ['Playwright Tests']
6+
types:
7+
- completed
8+
9+
jobs:
10+
comment:
11+
name: Upload Playwright report to s3
12+
if: github.event.workflow_run.event == 'pull_request'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Download Artifacts
16+
uses: dawidd6/action-download-artifact@v2
17+
with:
18+
workflow: ${{ github.event.workflow_run.workflow_id }}
19+
run_id: ${{ github.event.workflow_run.id }}
20+
- name: Extract PR Number
21+
id: pr
22+
run: echo "::set-output name=id::$(<pr/pr-id.txt)"
23+
shell: bash
24+
- name: Upload
25+
env:
26+
AWS_ACCESS_KEY_ID: ${{ secrets.STORYBOOK_S3_KEY_ID }}
27+
AWS_SECRET_ACCESS_KEY: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
28+
AWS_DEFAULT_REGION: ru-central1
29+
AWS_EC2_METADATA_DISABLED: true
30+
run: aws s3 cp playwright-report s3://playwright-reports/dynamic-forms/pulls/${{ steps.pr.outputs.id }}/ --endpoint-url=https://storage.yandexcloud.net --recursive
31+
shell: bash
32+
- name: Create Comment
33+
uses: marocchino/sticky-pull-request-comment@v2
34+
with:
35+
GITHUB_TOKEN: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
36+
number: ${{ steps.pr.outputs.id }}
37+
header: playwright test
38+
message: '[Playwright Test Component](https://storage.yandexcloud.net/playwright-reports/dynamic-forms/pulls/${{ steps.pr.outputs.id }}/index.html) is ready.'

0 commit comments

Comments
 (0)