Skip to content

Conversation

stephanosio
Copy link
Member

No description provided.

The commit 31ef45e converted the
maintainer check workflow from `pull_request` to `pull_request_target` --
this caused the "checkout" action to check out the base branch instead of
the pull request branch and effectively made the workflow compare the
mainline MAINTAINERS.yml against itself.

This commit reworks the workflow such that it checks out the pull request
MAINTAINERS.yml separately and compare it against the mainline
MAINTAINERS.yml checked out by the "checkout" action.

Note that the `requirements-actions.txt` and `check_maintainer_changes.py`
files used in this workflow are checked out from the base branch (i.e. does
not contain any modifications) and therefore do not pose a security risk.

Signed-off-by: Stephanos Ioannidis <[email protected]>
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: Stephanos Ioannidis <[email protected]>
PyGithub >= 2.7.0 is required for the
`Repository.get_collaborator_role_name` function used by the maintainer
check script.

Signed-off-by: Stephanos Ioannidis <[email protected]>
Copy link

sonarqubecloud bot commented Sep 9, 2025

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.

1 participant