New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strict check of pr-review write permission #1521
Conversation
There is currently no way to check the available scope of the tokens provided by GitHub; the tokens available for GitHub Actions vary in permissions in complex ways, depending on the repository, workflow settings, and how the workflow is launched. The most reliable way is to actually post review comments.
Is this pr review ready? |
No, I doesn't work expectly... |
it doesn't work with reviewdog-pr.
@haya14busa it's ready, can you review it please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really sorry for the late review 🙇🙇🙇
It looks promising. Thank you for your work!
I left a few comments.
service/github/github_test.go
Outdated
InDiffFile: true, | ||
InDiffContext: true, | ||
}, | ||
ToolName: "tool", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a bit more helpful tool name and message?
e.g. tool name: service/github/github_test.go
message: test message for TestGitHubPullRequest_Post_NoPermission
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed 0aa828d
service/github/github_test.go
Outdated
Result: &filter.FilteredDiagnostic{ | ||
Diagnostic: &rdf.Diagnostic{ | ||
Location: &rdf.Location{ | ||
Path: "reviewdog.go", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a file under _testdata/ file or service/github/github_test.go if this test expect outputting the actual github action log comments?
continue | ||
} | ||
|
||
rawComments = append(rawComments, c) | ||
if !c.Result.InDiffContext { | ||
// If the result is outside of diff context, fallback to GitHub Review | ||
// Comment API. | ||
comment := buildPullRequestComment(c, body, g.sha) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Unrelated to this pr]
I noticed that line (position) information is completely lost for these file comments and it must be confusing for most cases. 🤔
Probably we should add line (position) information in comment body.
(You don't need to address this comment in this pr. )
TestGitHubPullRequest_Post_NoPermission
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@haya14busa I'm glad the alternative way was found and merged. (Though, it's a bit sad that the PR #1406 was closed without any interaction after a long pending time) |
There is currently no way to check the available scope of the tokens provided by GitHub; the tokens available for GitHub Actions vary in permissions in complex ways, depending on the repository, workflow settings, and how the workflow is launched.
The most reliable way is to actually post review comments.
close #1210