casbin / casbin-rs

An authorization library that supports access control models like ACL, RBAC, ABAC in Rust.
https://casbin.org
Apache License 2.0
844 stars 69 forks source link

fix: benchmark workflow cannot post comment to PR #298

Closed greenhandatsjtu closed 2 years ago

greenhandatsjtu commented 2 years ago

Fix: https://github.com/casbin/casbin-rs/issues/294 I found benchmark workflow doesn’t work well that it fails to post comment to PR. The reason is GITHUB_TOKEN only has read permission to pull requests when access by forked repos, so when a new PR is coming, running workflows only has read-only permission (of course not allowed to post comment). ref: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token

Luckily, GitHub has introduced a new event type: pull_request_target, which allows to run workflows from base branch and pass a token with write permission, so we can use it to post benchmark results to PR (ref: https://github.community/t/github-actions-are-severely-limited-on-prs/18179/17).

I modify pull_request.yml to use pull_request_target, now it works well: image

casbin-bot commented 2 years ago

@smrpn @hackerchai @PsiACE @GopherJ please review

codecov[bot] commented 2 years ago

Codecov Report

Merging #298 (1ccd8bd) into master (663e764) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #298   +/-   ##
=======================================
  Coverage   81.46%   81.46%           
=======================================
  Files          23       23           
  Lines        3463     3463           
=======================================
  Hits         2821     2821           
  Misses        642      642           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 663e764...1ccd8bd. Read the comment docs.