cpp-linter / cpp-linter-action

A Github Action for linting C/C++ code integrating clang-tidy and clang-format to collect feedback provided in the form of file-annotations, thread-comments, workflow step-summary, and Pull Request reviews.

Home Page:https://cpp-linter.github.io/cpp-linter-action/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add documentation for GITHUB_TOKEN requirement

malaterre opened this issue · comments

The documentation does not make it very clear what type of access is required:

  1. fine-grained personal access token ?
  2. personal access token (classic) ?

What type of permissions ?

Thanks

This is mainly because it was unclear from the REST API docs what exact permission it needed to execute.

You are correct though. We should mention explicitly what permissions are used when the token is required.

Just so you can see what vagueness I'm working with:

  1. REST API list of endpoints for commits and issues which is used for PR threads also. The pulls endpoints are about PR reviews (when it concerns comments) which are much more complex to implement, so we hardly use the pulls endpoints.
  2. We use the following REST API when tokens are needed:
  1. fine-grained personal access token ?

This feature is still in beta and lacks adequate documentation to answer the question. While it might work with this action, we won't be held responsible if it doesn't.


From what I can gather, I think the following permissions are used when a token is required (for a public repo). Note, this is mostly guesses since the REST API doesn't always mention for what the token needs permission.

permissions:
  checks: read|write
  # write for our file-annotations option (I think - probably not)

  pull-requests: read|write 
  # write to remove duplicate action comments and post new comments
  # read to get a list of changed files and a list of existing comments

  repository-projects: read|write  # (for push events)
  # write to remove duplicate action comments and post new comments
  # read to get list of changed files and a list of existing comments

See also Assigning permissions to jobs.

Private repo access seems largely undocumented, but we have [reportedly] run into permission problems when getting a list of PR comments and a list of changed files.


I think the only way we can be certain what permissions are needed is by trial and error (we have a test repo for that). But my time is currently limited, and I would very much appreciate user feedback on what permission settings worked and what didn't.

Could also comment, why at least one alternative solution works out of the box (no need for GITHUB_TOKEN setup):

Example:

AFAIK all read operations are supported, the only missing one is the writting on pull pages. Which for some reason is supported by default with ZedThree/clang-tidy-review.