Skip to content

Commit 7e1ee2e

Browse files
authored
Fix link to PR files in PR auto-comment (#1014)
1 parent 340bab0 commit 7e1ee2e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/integration-test-review.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
fs.writeFileSync(path.join(temp, 'pr_number.zip'), Buffer.from(download.data));
5858
5959
- name: Unzip downloaded PR number artifact
60+
# The name of the output require-result is a bit confusing, but when its value
61+
# is 'false', it means that the triggering actor does NOT have the required
62+
# permission.
6063
if: ${{ !env.ACT && steps.permission.outputs.require-result == 'false' }}
6164
run: unzip "${{ runner.temp }}/artifacts/pr_number.zip" -d "${{ runner.temp }}/artifacts"
6265

@@ -80,15 +83,15 @@ jobs:
8083
const { owner, repo } = context.repo;
8184
8285
// Read the PR number from the downloaded and unzipped artifact.
83-
const issue_number = Number(fs.readFileSync(path.join(temp, 'pr_number')));
86+
const pr_number = Number(fs.readFileSync(path.join(temp, 'pr_number')));
8487
8588
// Get the URL of the PR so we can add a link in the PR comment.
86-
const { html_url } = await github.rest.issues.get({ owner, repo, issue_number });
89+
const { html_url } = await github.rest.pulls.get({ owner, repo, pr_number });
8790
8891
github.rest.issues.createComment({
8992
owner,
9093
repo,
91-
issue_number,
94+
pr_number,
9295
body: "User [${{ github.triggering_actor }}](${{ github.event.workflow_run.head_repository.owner.html_url }})"
9396
+ " does not have permission to run integration tests. A maintainer must perform a security review of the"
9497
+ ` [code changes in this pull request](${html_url}/files) and re-run the`

0 commit comments

Comments
 (0)