Skip to content
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

Check permission #95

Merged
merged 3 commits into from
Jan 14, 2022
Merged

Check permission #95

merged 3 commits into from
Jan 14, 2022

Conversation

CasperWA
Copy link
Owner

Fixes #94
Closes #93

This PR implements a permissions check for the used token. If the token is a PAT it represents the user associated with this PAT. Hence, it is a permissions/rights check for the user's PAT for the particular repository.

"admin" permission (granted through the "Admin" role or as owner) is necessary to access a protected branch: get info about the status of required checks and to toggle the "review required"-protection rule.

If the token does not have this permission level, the action will fail when/if trying to do these jobs. This will only happen for protected branches however, so technically the check is done if the the branch is detected to be protected - something that can be done with the lowest of rights (for a public repo, for a private repo a token representing a user with at least "pull" permission ("Read" role) still need to be supplied).

Get branch to check protection.
Check if token has "admin" permission if the branch is protected.
The `debug` option is a boolean, defaults to `False`.
If `True` it runs `set -x` in `entrypoint.sh` as the first thing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn or error upon using token without proper rights Add debug option
1 participant