summaryrefslogtreecommitdiff
path: root/.github/workflows/playwright_comment.yml
diff options
context:
space:
mode:
authorxy2 <hugo@xy2.dev>2023-03-30 18:01:28 +0200
committerGitHub <noreply@github.com>2023-03-30 18:01:28 +0200
commit3c860f671e316e919602fc92bc88490c4b4c2205 (patch)
tree26cf396e8e6d6428269001bd6ca7395980fb0597 /.github/workflows/playwright_comment.yml
parent52eb25ee0715d85356fa5d23f46e7da9003300a9 (diff)
parent46dd7a261d23a1f8f124a3a459be1ed3e3bec1ff (diff)
Merge branch 'master' into cjk
Diffstat (limited to '.github/workflows/playwright_comment.yml')
-rw-r--r--.github/workflows/playwright_comment.yml26
1 files changed, 19 insertions, 7 deletions
diff --git a/.github/workflows/playwright_comment.yml b/.github/workflows/playwright_comment.yml
index 8c33b618..6b50631d 100644
--- a/.github/workflows/playwright_comment.yml
+++ b/.github/workflows/playwright_comment.yml
@@ -18,19 +18,17 @@ jobs:
- name: Grab playwright-output from PR run
uses: dawidd6/action-download-artifact@5e780fc7bbd0cac69fc73271ed86edf5dcb72d67 # pin@v2
continue-on-error: true
- id: playwright-output
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- run-id: ${{ github.event.workflow_run.id }}
+ run_id: ${{ github.event.workflow_run.id }}
name: playwright-output
- name: Grab master-screenshots-outcome from PR run
uses: dawidd6/action-download-artifact@5e780fc7bbd0cac69fc73271ed86edf5dcb72d67 # pin@v2
continue-on-error: true
- id: master-screenshots-outcome
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- run-id: ${{ github.event.workflow_run.id }}
+ run_id: ${{ github.event.workflow_run.id }}
name: master-screenshots-outcome
- name: Load artifacts into environment variables
@@ -40,27 +38,41 @@ jobs:
echo "PLAYWRIGHT_OUTPUT<<$EOF" >> $GITHUB_OUTPUT
cat ./playwright-output >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
+ echo "MASTER_SCREENSHOTS_OUTCOME<<$EOF" >> $GITHUB_OUTPUT
+ cat ./master-screenshots-outcome >> $GITHUB_OUTPUT
+ echo "$EOF" >> $GITHUB_OUTPUT
echo "NUM_FAILED=$(grep -c 'Screenshot comparison failed' $GITHUB_OUTPUT)" >> $GITHUB_OUTPUT
+ # this is required because github.event.workflow_run.pull_requests is not available for PRs from forks
+ - name: "Get PR information"
+ uses: potiuk/get-workflow-origin@e2dae063368361e4cd1f510e8785cd73bca9352e # pin@v1_5
+ id: source-run-info
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ sourceRunId: ${{ github.event.workflow_run.id }}
+
- name: "[Comment] Couldn't download screenshots from master branch"
uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 # pin@v2
- if: github.event_name == 'pull_request' && steps.master-screenshots-outcome == 'failure'
+ if: steps.playwright.outputs.MASTER_SCREENSHOTS_OUTCOME == 'failure'
with:
+ issue: ${{ steps.source-run-info.outputs.pullRequestNumber }}
message: |
:heavy_exclamation_mark: Could not fetch screenshots from master branch, so had nothing to make a visual comparison against; please check the "master-screenshots" step in the workflow run and rerun it before merging.
- name: "[Comment] Success: No visual differences introduced by this PR"
uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 # pin@v2
- if: github.event_name == 'pull_request' && steps.master-screenshots-outcome != 'failure' && steps.playwright.outputs.NUM_FAILED == 0
+ if: steps.playwright.outputs.MASTER_SCREENSHOTS_OUTCOME != 'failure' && steps.playwright.outputs.NUM_FAILED == 0
with:
+ issue: ${{ steps.source-run-info.outputs.pullRequestNumber }}
message: |
:heavy_check_mark: No visual differences introduced by this PR.
[View Playwright Report](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}#artifacts) (note: open the "playwright-report" artifact)
- name: "[Comment] Warning: Visual differences introduced by this PR"
uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 # pin@v2
- if: github.event_name == 'pull_request' && steps.master-screenshots-outcome != 'failure' && steps.playwright.outputs.NUM_FAILED != 0
+ if: steps.playwright.outputs.MASTER_SCREENSHOTS_OUTCOME != 'failure' && steps.playwright.outputs.NUM_FAILED != 0
with:
+ issue: ${{ steps.source-run-info.outputs.pullRequestNumber }}
message: |
:warning: ${{ steps.playwright.outputs.NUM_FAILED }} visual differences introduced by this PR; please validate if they are desirable.
<details>