From f84a77c522aaa64f773252f8fad437e290ffcdaa Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 15 Jul 2023 12:36:02 +0200 Subject: [PATCH] Always run "Post Screenshot URL" and link to log --- .github/workflows/test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 637c174e..2485585c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -93,7 +93,7 @@ jobs: echo "SCREENSHOT_URL=$SCREENSHOT_URL" >> $GITHUB_ENV || true echo "SCREENSHOT_URL: ${SCREENSHOT_URL}" || true - name: Post Screenshot URL - if: github.event_name == 'pull_request' + if: ${{ always() && github.event_name == 'pull_request' }} uses: actions/github-script@v4 with: script: | @@ -108,12 +108,14 @@ jobs: body: commentBody }); } else { - const commentBody = "The test was unable to make a screenshot. Most likely the test did not succeed. Please check the logs of the test run, even though it might be green or yellow."; + const logURL = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`; + const commentBody = `The test was unable to make a screenshot. Most likely the test did not succeed. Please check the [logs of the test run](${logURL}).`; await github.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber, body: commentBody }); - core.setFailed("Unable to post screenshot") + core.setFailed("Unable to post screenshot"); } +