我正在使用一个 Github Action 来比较基准测试结果,并将它们作为评论发布在 PR 上。
这是该 Action 的文件 - https://github.com/smrpn/criterion-compare-action/blob/move_to_actions/main.js。
它的含义是 -
我正在使用另一个专门用于此目的(注释基准测试结果)的令牌 -
它的含义是 -
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");
}
我正在使用另一个专门用于此目的(注释基准测试结果)的令牌 -
BENCHMARK_TOKEN
。但是,当PR来自分叉的存储库时,它不会进行注释。这就是现在的问题 - https://github.com/hackerchai/casbin-rs/runs/2648902413#step:5:614
修复方法是什么?我希望Github机器人在每个PR上发表评论。
pull_request_target
,据我所知。 - Thatkookooguy