Disable Post Screenshot [ci skip]

This commit is contained in:
probonopd authored and GitHub committed 2023-09-13 20:38:33 +02:00
1 parent 2c1fca4ad3
commit f0d4c3fb8b
1 file changed
+28 -28
+28 -28
View File
@@ -98,31 +98,31 @@ jobs:
fi
echo "SCREENSHOT_URL=$SCREENSHOT_URL" >> $GITHUB_ENV || true
echo "SCREENSHOT_URL: ${SCREENSHOT_URL}" || true
- name: Post Screenshot URL
if: ${{ always() && github.event_name == 'pull_request' && github.run_status != 'cancelled' }}
uses: actions/github-script@v6
with:
script: |
const prNumber = context.payload.pull_request.number;
const screenshotURL = process.env.SCREENSHOT_URL;
if (screenshotURL) {
const commentBody = `Seems like the test succeeded. Temporary screenshot URL: ${screenshotURL}`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: commentBody
});
} else {
const runURL = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${{ 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](${runURL}).`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: commentBody
});
core.setFailed("Unable to post screenshot");
}
# The following is disabled because it gives errors about missing permissions
# whenever a PR is made by anyone but the repo maintainer
# - name: Post Screenshot URL
# if: ${{ always() && github.event_name == 'pull_request' && github.run_status != 'cancelled' }}
# uses: actions/github-script@v6
# with:
# script: |
# const prNumber = context.payload.pull_request.number;
# const screenshotURL = process.env.SCREENSHOT_URL;
# if (screenshotURL) {
# const commentBody = `Seems like the test succeeded. Temporary screenshot URL: ${screenshotURL}`;
# await github.rest.issues.createComment({
# owner: context.repo.owner,
# repo: context.repo.repo,
# issue_number: prNumber,
# body: commentBody
# });
# } else {
# const runURL = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${{ 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](${runURL}).`;
# await github.rest.issues.createComment({
# owner: context.repo.owner,
# repo: context.repo.repo,
# issue_number: prNumber,
# body: commentBody
# });
# core.setFailed("Unable to post screenshot");
# }