I am using a github action that compares benchmark results and posts them as a comment on the PR. This is the actions file - https://github.com/smrpn/criterion-compare-action/blob/move_to_actions/main.js
it says -
try {
await octokit.issues.createComment({
...context.repo,
issue_number: context.payload.pull_request.number,
body: resultsAsMarkdown,
});
} catch (e) {
// If we can't post to the comment, display results here.
// forkedRepos only have READ ONLY access on GITHUB_TOKEN
// https://github.community/t5/GitHub-Actions/quot-Resource-not-accessible-by-integration-quot-for-adding-a/td-p/33925
const resultsAsObject = convertToTableObject(myOutput);
fs.writeFile('benchResults.txt', resultsAsObject, (err) => {
if (err) throw err;
});
console.table(resultsAsObject);
console.log("Failed to comment\n", e);
core.debug(e);
core.debug("Failed to comment");
}
I'm using a another token made for this purpose(commenting the benchmark results) - BENCHMARK_TOKEN
.
But it does not comment when the PR is from a forked repo.
This is the problem right now - https://github.com/hackerchai/casbin-rs/runs/2648902413#step:5:614
What is the fix? I want a comment by the github bot on every PR.