From dd8aaa92fd4999c719f72a769ceba9e928ee2fb0 Mon Sep 17 00:00:00 2001 From: literat Date: Mon, 11 Mar 2024 17:07:41 +0100 Subject: [PATCH] Chore(ci): Create comment with e2e tests report when failuire --- .github/workflows/e2e.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c753e2f245..4cc8ec0298 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -96,3 +96,23 @@ jobs: name: playwright-report path: playwright-report/ retention-days: 30 + + - name: Comment PR with artifact URL + if: failure() + uses: actions/github-script@v5 + with: + script: | + const artifactName = 'playwright-report'; + const artifactUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/artifacts/${artifactName}`; + const issue_number = context.issue.number; + const repo = context.repo.repo; + const owner = context.repo.owner; + + await github.rest.issues.createComment({ + owner, + repo, + issue_number, + body: `Here is the URL of the uploaded artifact: ${artifactUrl}` + }); + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}