Skip to content

wrong api url in organisation/teams.php for add/removeRepository #921

Description

@bt-dennis-kokot

I got a not found exception by using
$client->api('organization')->teams()->addRepository(...)

I found this in the documentation:
https://docs.github.com/en/rest/reference/teams#add-or-update-team-repository-permissions
put /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}

current code:

if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin'])) {
    return $this->put('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository), $params);
}

code suggestion:

if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'maintain', 'triage', 'admin'])) {
    return $this->put('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository), $params);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions