Skip to content

Checking for user permissions will fail if user is a member of the nested team #120

Open
@yafanasiev

Description

@yafanasiev

Hi! First of all, thanks for a wonderful action. We do use it a lot.

We hit an issue where users who have write access to the repository can't trigger slash commands when permission property is set to write. After investigation, I found out that the issue occurs if user has permissions on repository through the nested team (so the team main is assigned write permissions on the repo, it has sub-team sub, and user is a member of team sub). I tried to reproduce the calls that actions does locally (specifically

async getActorPermission(repo: Repository, actor: string): Promise<string> {
and it appers that for those users Github's API returns empty reponse. After reaching out to Github support, they acknowledge this as a intendent behaviour for now, to quote them

the collaborators relation only returns first-level users (users that are directly added to repository) or members of the team that is added to the repository, but not nested teams

and this is something that could change in the future, but not right now.
I do understand that this is something relatively specific to our use case, but I am adding this in case someone hits the same problem and does not waste as much time as we did. I also checked REST API version of this request , and it returns the correct list of collaborators. This could server as a substitute for current implementation, but would require getting all of the collaborators and then filtering by current actor name, which is not quite neat as the GraphQL version. So it is up to mainteners to make the call, but at least this could be added to README somewhere to save others some time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions