diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eed878cb8..dc096715a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,7 @@ jobs: output-file-path: examples/rust/output.txt fail-on-alert: true summary-always: true + comment-always: true - run: node ./dist/scripts/ci_validate_modification.js before_data.js 'Rust Benchmark' go: diff --git a/src/write.ts b/src/write.ts index 3c71823a7..08ce31b94 100644 --- a/src/write.ts +++ b/src/write.ts @@ -241,14 +241,23 @@ async function leaveComment(commitId: string, body: string, token: string) { const repoMetadata = getCurrentRepoMetadata(); const repoUrl = repoMetadata.html_url ?? ''; + const pr = github.context.payload.pull_request; const client = github.getOctokit(token); - const res = await client.rest.repos.createCommitComment({ - owner: repoMetadata.owner.login, - repo: repoMetadata.name, - // eslint-disable-next-line @typescript-eslint/naming-convention - commit_sha: commitId, - body, - }); + const res = await (pr?.number + ? client.rest.pulls.createReviewComment({ + owner: repoMetadata.owner.login, + repo: repoMetadata.name, + // eslint-disable-next-line @typescript-eslint/naming-convention + pull_number: pr.number, + body, + }) + : client.rest.repos.createCommitComment({ + owner: repoMetadata.owner.login, + repo: repoMetadata.name, + // eslint-disable-next-line @typescript-eslint/naming-convention + commit_sha: commitId, + body, + })); const commitUrl = `${repoUrl}/commit/${commitId}`; console.log(`Comment was sent to ${commitUrl}. Response:`, res.status, res.data);