Skip to content
Commit 5a4b0ac4 authored by Stephanos Ioannidis's avatar Stephanos Ioannidis Committed by Chris Friedt
Browse files

scripts: check_maintainer_changes: Fix GitHub user access check

The PyGithub `Repository.get_collaborator_permission` function invokes the
GitHub REST API `/repos/{owner}/{repo}/collaborators/{username}/permission`
and returns the value of the `permission` attribute in the response.

As per the GitHub documentation [1], the `permission` attribute "provides
the legacy base roles of admin, write, read and none, where the maintain
role is mapped to write and the triage role is mapped to read", and this
caused the users with `triage` permission level (i.e. the users in the
`contributors` team) to be incorrectly flagged by the script.

This commit updates the script to use the `get_collaborator_role_name`
function, which correctly returns the up-to-date user permission/role name,
including `maintain` and `triage`.

Note that the `get_collaborator_role_name` function is only available in
PyGithub>=2.7.0.

[1] https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#get-repository-permissions-for-a-user



Signed-off-by: default avatarStephanos Ioannidis <root@stephanos.io>
parent f20aa23a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment