Skip to content

Misleading Repository.create_fork docstring? #2116

@xmo-odoo

Description

@xmo-odoo

I'm currently exploring the behaviour of GH's edge cases, and figured PyGithub was a more convenient way to access it than raw requests calls, however in looking at create_fork I stumbled upon something odd: the docstring says

:param organization: string or "none" or "*"

however:

  • * is mentioned nowhere in github's own documentation
  • there seems to be no special codepath inside pygithub special-casing this, the string is just passed directly to the API
  • when calling repo.create_fork("*") I get the same error as passing in any other non-existent organisation name:
    github.GithubException.GithubException: 422 {
        "message": "Validation Failed", 
        "errors": [{
            "resource": "Fork",
            "code": "invalid",
            "field": "organization"
        }],
        "documentation_url": "https://docs.github.com/rest/reference/repos#create-a-fork"
    }
    

Is this a remnant of an older revision or somesuch? I think this section of docstrings should probably be updated to:

:param str organization: name of the organisation to create the fork in, omit to fork in the current user's account

(after some testing, specifying the current user's login explicitely fails, and the error message explicitely notes that the error comes from it being a user account a opposed to an organisation)

/cc @timgates42

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions