Repository

class github.Repository.Repository

This class represents Repositories.

The reference can be found here https://docs.github.com/en/rest/reference/repos

The OpenAPI schema can be found at

  • /components/schemas/event/properties/repo

  • /components/schemas/full-repository

  • /components/schemas/minimal-repository

  • /components/schemas/nullable-repository

  • /components/schemas/pull-request-minimal/properties/base/properties/repo

  • /components/schemas/pull-request-minimal/properties/head/properties/repo

  • /components/schemas/repository

  • /components/schemas/simple-repository

A CompletableGithubObject can be partially initialised (completed=False). Accessing attributes that are not initialized will then trigger a request to complete all attributes.

A partially initialized CompletableGithubObject (completed=False) can be completed via complete(). This requires the url to be given via parameter url or attributes.

With a requester where Requester.is_lazy == True, this CompletableGithubObjects is partially initialized. This requires the url to be given via parameter url or attributes. Any CompletableGithubObject created from this lazy object will be lazy itself if created with parameter url or attributes.

Parameters:
  • requester – requester

  • headers – response headers

  • attributes – attributes to initialize

  • completed – do not update non-initialized attributes when True

  • url – url of this instance, overrides attributes[‘url’]

  • accept – use this accept header when completing this instance

property allow_auto_merge: bool
Type:

bool

property allow_forking: bool
Type:

bool

property allow_merge_commit: bool
Type:

bool

property allow_rebase_merge: bool
Type:

bool

property allow_squash_merge: bool
Type:

bool

property allow_update_branch: bool
Type:

bool

property archive_url: str
Type:

string

property archived: bool
Type:

bool

property assignees_url: str
Type:

string

property blobs_url: str
Type:

string

property branches_url: str
Type:

string

property clone_url: str
Type:

string

property collaborators_url: str
Type:

string

property comments_url: str
Type:

string

property commits_url: str
Type:

string

property compare_url: str
Type:

string

property contents_url: str
Type:

string

property contributors_url: str
Type:

string

property created_at: datetime
Type:

datetime

property custom_properties: dict[str, None | str | list]
Type:

dict[str, None | str | list]

property default_branch: str
Type:

string

property delete_branch_on_merge: bool
Type:

bool

property deployments_url: str
Type:

string

property description: str
Type:

string

property downloads_url: str
Type:

string

property events_url: str
Type:

string

property fork: bool
Type:

bool

property forks: int
Type:

integer

property forks_count: int
Type:

integer

property forks_url: str
Type:

string

property full_name: str
Type:

string

property git_commits_url: str
Type:

string

property git_refs_url: str
Type:

string

property git_tags_url: str
Type:

string

property git_url: str
Type:

string

property has_discussions: bool
Type:

bool

property has_downloads: bool
Type:

bool

property has_issues: bool
Type:

bool

property has_pages: bool
Type:

bool

property has_projects: bool
Type:

bool

property has_wiki: bool
Type:

bool

property homepage: str
Type:

string

property hooks_url: str
Type:

string

property html_url: str
Type:

string

property id: int
Type:

integer

property is_template: bool
Type:

bool

property issue_comment_url: str
Type:

string

property issue_events_url: str
Type:

string

property issues_url: str
Type:

string

property keys_url: str
Type:

string

property labels_url: str
Type:

string

property language: str
Type:

string

property languages_url: str
Type:

string

property merge_commit_message: str
Type:

string

property merge_commit_title: str
Type:

string

property merges_url: str
Type:

string

property milestones_url: str
Type:

string

property mirror_url: str
Type:

string

property name: str
Type:

string

property network_count: int
Type:

integer

property notifications_url: str
Type:

string

property open_issues: int
Type:

integer

property open_issues_count: int
Type:

integer

property organization: Organization
Type:

github.Organization.Organization

property owner: NamedUser
Type:

github.NamedUser.NamedUser

property parent: Repository
Type:

github.Repository.Repository

property permissions: Permissions
Type:

github.Permissions.Permissions

property private: bool
Type:

bool

property pulls_url: str
Type:

string

property pushed_at: datetime
Type:

datetime

property releases_url: str
Type:

string

property security_and_analysis: SecurityAndAnalysis
Type:

github.SecurityAndAnalysis.SecurityAndAnalysis

property size: int
Type:

integer

property source: Repository | None
Type:

github.Repository.Repository

property squash_merge_commit_message: str
Type:

string

property squash_merge_commit_title: str
Type:

string

property ssh_url: str
Type:

string

property stargazers_count: int
Type:

integer

property stargazers_url: str
Type:

string

property statuses_url: str
Type:

string

property subscribers_count: int
Type:

integer

property subscribers_url: str
Type:

string

property subscription_url: str
Type:

string

property svn_url: str
Type:

string

property tags_url: str
Type:

string

property teams_url: str
Type:

string

property topics: list[str]
Type:

list of strings

property trees_url: str
Type:

string

property updated_at: datetime
Type:

datetime

property web_commit_signoff_required: bool
Type:

bool

add_to_collaborators(collaborator: str | NamedUser, permission: Opt[str] = NotSet) Invitation | None
Calls:

PUT /repos/{owner}/{repo}/collaborators/{username}

Parameters:
  • collaborator – string or github.NamedUser.NamedUser

  • permission – string ‘pull’, ‘push’, ‘admin’, ‘maintain’, ‘triage’, or a custom repository role name, if the owning organization has defined any

Return type:

None

get_collaborator_permission(collaborator: str | NamedUser) str
Calls:

GET /repos/{owner}/{repo}/collaborators/{username}/permission

Parameters:

collaborator – string or github.NamedUser.NamedUser

Return type:

string

get_collaborator_role_name(collaborator: str | NamedUser) str
Calls:

GET /repos/{owner}/{repo}/collaborators/{username}/permission

Parameters:

collaborator – string or github.NamedUser.NamedUser

Return type:

string

get_pending_invitations() PaginatedList[Invitation]
Calls:

GET /repos/{owner}/{repo}/invitations

Return type:

PaginatedList of github.Invitation.Invitation

remove_invitation(invite_id: int) None
Calls:

DELETE /repos/{owner}/{repo}/invitations/{invitation_id}

Return type:

None

compare(base: str, head: str) Comparison
Calls:

GET /repos/{owner}/{repo}/compare/{basehead}

Parameters:
  • base – string

  • head – string

Return type:

github.Comparison.Comparison

Calls:

POST /repos/{owner}/{repo}/autolinks

Parameters:
  • key_prefix – string

  • url_template – string

  • is_alphanumeric – bool

Return type:

github.Autolink.Autolink

create_git_blob(content: str, encoding: str) GitBlob
Calls:

POST /repos/{owner}/{repo}/git/blobs

Parameters:
  • content – string

  • encoding – string

Return type:

github.GitBlob.GitBlob

create_git_commit(message: str, tree: GitTree, parents: list[GitCommit], author: Opt[InputGitAuthor] = NotSet, committer: Opt[InputGitAuthor] = NotSet) GitCommit
Calls:

POST /repos/{owner}/{repo}/git/commits

Parameters:
Return type:

github.GitCommit.GitCommit

create_git_ref(ref: str, sha: str) GitRef
Calls:

POST /repos/{owner}/{repo}/git/refs

Parameters:
  • ref – string

  • sha – string

Return type:

github.GitRef.GitRef

create_git_tag_and_release(tag: str, tag_message: str, release_name: Opt[str], release_message: Opt[str], object: str, type: str, tagger: Opt[InputGitAuthor] = NotSet, draft: bool = False, prerelease: bool = False, generate_release_notes: bool = False, make_latest: str = 'true') GitRelease

Convenience function that calls Repository.create_git_tag() and Repository.create_git_release().

Parameters:
  • tag – string

  • tag_message – string

  • release_name – string

  • release_message – string

  • object – string

  • type – string

  • tagger – :class:github.InputGitAuthor.InputGitAuthor

  • draft – bool

  • prerelease – bool

  • generate_release_notes – bool

  • make_latest – string

Return type:

github.GitRelease.GitRelease

create_git_release(tag: str, name: Opt[str] = NotSet, message: Opt[str] = NotSet, draft: bool = False, prerelease: bool = False, generate_release_notes: bool = False, target_commitish: Opt[str] = NotSet, make_latest: str = 'true') GitRelease
Calls:

POST /repos/{owner}/{repo}/releases

Parameters:
Return type:

github.GitRelease.GitRelease

generate_release_notes(tag_name: str, previous_tag_name: str | _NotSetType = NotSet, target_commitish: str | _NotSetType = NotSet, configuration_file_path: str | _NotSetType = NotSet) GeneratedReleaseNotes
Calls:

POST /repos/{owner}/{repo}/releases/generate-notes <https://docs.github.com/en/rest/releases/releases#generate-release-notes-content-for-a-release>

Parameters:
  • tag_name – The tag name for the release. This can be an existing tag or a new one.

  • previous_tag_name – The name of the previous tag to use as the starting point for the release notes. Use to manually specify the range for the set of changes considered as part this release.

  • target_commitish – Specifies the commitish value that will be the target for the release’s tag. Required if the supplied tag_name does not reference an existing tag. Ignored if the tag_name already exists.

  • configuration_file_path – Specifies a path to a file in the repository containing configuration settings used for generating the release notes. If unspecified, the configuration file located in the repository at ‘.github/release.yml’ or ‘.github/release.yaml’ will be used. If that is not present, the default configuration will be used.

Rytpe:

GeneratedReleaseNotes

create_git_tag(tag: str, message: str, object: str, type: str, tagger: Opt[InputGitAuthor] = NotSet) GitTag
Calls:

POST /repos/{owner}/{repo}/git/tags

create_git_tree(tree: list[InputGitTreeElement], base_tree: Opt[GitTree] = NotSet) GitTree
Calls:

POST /repos/{owner}/{repo}/git/trees

Parameters:
Return type:

github.GitTree.GitTree

create_hook(name: str, config: dict[str, str], events: Opt[list[str]] = NotSet, active: Opt[bool] = NotSet) Hook
Calls:

POST /repos/{owner}/{repo}/hooks

Parameters:
  • name – string

  • config – dict

  • events – list of string

  • active – bool

Return type:

github.Hook.Hook

create_issue(title: str, body: Opt[str] = NotSet, assignee: NamedUser | Opt[str] = NotSet, milestone: Opt[Milestone] = NotSet, labels: list[Label] | Opt[list[str]] = NotSet, assignees: Opt[list[str]] | list[NamedUser] = NotSet) Issue
Calls:

POST /repos/{owner}/{repo}/issues

Parameters:
Return type:

github.Issue.Issue

create_key(title: str, key: str, read_only: bool = False) RepositoryKey
Calls:

POST /repos/{owner}/{repo}/keys

Parameters:
  • title – string

  • key – string

  • read_only – bool

Return type:

github.RepositoryKey.RepositoryKey

create_label(name: str, color: str, description: Opt[str] = NotSet) Label
Calls:

POST /repos/{owner}/{repo}/labels

Parameters:
  • name – string

  • color – string

  • description – string

Return type:

github.Label.Label

create_milestone(title: str, state: Opt[str] = NotSet, description: Opt[str] = NotSet, due_on: Opt[date] = NotSet) Milestone
Calls:

POST /repos/{owner}/{repo}/milestones

Parameters:
  • title – string

  • state – string

  • description – string

  • due_on – datetime

Return type:

github.Milestone.Milestone

create_project(name: str, body: Opt[str] = NotSet) Project
Calls:

POST /repos/{owner}/{repo}/projects

Parameters:
  • name – string

  • body – string

Return type:

github.Project.Project

create_pull(base: str, head: str, *, title: str | _NotSetType = NotSet, body: str | _NotSetType = NotSet, maintainer_can_modify: bool | _NotSetType = NotSet, draft: bool | _NotSetType = NotSet, issue: Issue | _NotSetType = NotSet) PullRequest
Calls:

POST /repos/{owner}/{repo}/pulls

create_repository_advisory(summary: str, description: str, severity_or_cvss_vector_string: str, cve_id: str | None = None, vulnerabilities: Iterable[github.AdvisoryVulnerability.AdvisoryVulnerabilityInput] | None = None, cwe_ids: Iterable[str] | None = None, credits: Iterable[github.AdvisoryCredit.AdvisoryCredit] | None = None) github.RepositoryAdvisory.RepositoryAdvisory
Calls:

POST /repos/{owner}/{repo}/security-advisories

Parameters:
  • summary – string

  • description – string

  • severity_or_cvss_vector_string – string

  • cve_id – string

  • vulnerabilities – iterable of github.AdvisoryVulnerability.AdvisoryVulnerabilityInput

  • cwe_ids – iterable of string

  • credits – iterable of github.AdvisoryCredit.AdvisoryCredit

Return type:

github.RepositoryAdvisory.RepositoryAdvisory

report_security_vulnerability(summary: str, description: str, severity_or_cvss_vector_string: str, cve_id: str | None = None, vulnerabilities: Iterable[github.AdvisoryVulnerability.AdvisoryVulnerabilityInput] | None = None, cwe_ids: Iterable[str] | None = None, credits: Iterable[github.AdvisoryCredit.AdvisoryCredit] | None = None) github.RepositoryAdvisory.RepositoryAdvisory
Calls:

POST /repos/{owner}/{repo}/security-advisories/reports

Parameters:
  • summary – string

  • description – string

  • severity_or_cvss_vector_string – string

  • cve_id – string

  • vulnerabilities – iterable of github.AdvisoryVulnerability.AdvisoryVulnerabilityInput

  • cwe_ids – iterable of string

  • credits – iterable of github.AdvisoryCredit.AdvisoryCredit

Return type:

github.RepositoryAdvisory.RepositoryAdvisory

create_repository_dispatch(event_type: str, client_payload: dict[str, Any] | _NotSetType = NotSet) bool
Calls:

POST /repos/{owner}/{repo}/dispatches <https://docs.github.com/en/rest/repos#create-a-repository-dispatch-event>

Parameters:
  • event_type – string

  • client_payload – dict

Return type:

bool

create_secret(secret_name: str, unencrypted_value: str, secret_type: str = 'actions') Secret
Calls:

PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}

Calls:

PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name}

Parameters:

secret_type – string options actions or dependabot

get_secrets(secret_type: str = 'actions') PaginatedList[Secret]

Gets all repository secrets :param secret_type: string options actions or dependabot.

get_secret(secret_name: str, secret_type: str = 'actions') Secret
Calls:

GET /repos/{owner}/{repo}/actions/secrets/{secret_name}

Parameters:

secret_type – string options actions or dependabot

create_variable(variable_name: str, value: str) Variable
Calls:

POST /repos/{owner}/{repo}/actions/variables/{name}

get_variables() PaginatedList[Variable]

Gets all repository variables :rtype: PaginatedList of github.Variable.Variable

get_variable(variable_name: str) Variable
Calls:

GET /repos/{owner}/{repo}/actions/variables/{name}

Parameters:

variable_name – string

Return type:

github.Variable.Variable

delete_secret(secret_name: str, secret_type: str = 'actions') bool
Calls:

DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}

Calls:

DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name}

Parameters:
  • secret_name – string

  • secret_type – string options actions or dependabot

Return type:

bool

delete_variable(variable_name: str) bool
Calls:

DELETE /repos/{owner}/{repo}/actions/variables/{name}

Parameters:

variable_name – string

Return type:

bool

create_source_import(vcs: str, vcs_url: str, vcs_username: Opt[str] = NotSet, vcs_password: Opt[str] = NotSet) SourceImport
Calls:

PUT /repos/{owner}/{repo}/import

Parameters:
  • vcs – string

  • vcs_url – string

  • vcs_username – string

  • vcs_password – string

Return type:

github.SourceImport.SourceImport

delete() None
Calls:

DELETE /repos/{owner}/{repo}

Return type:

None

edit(name: str | None = None, description: str | _NotSetType = NotSet, homepage: str | _NotSetType = NotSet, private: bool | _NotSetType = NotSet, visibility: str | _NotSetType = NotSet, has_issues: bool | _NotSetType = NotSet, has_projects: bool | _NotSetType = NotSet, has_wiki: bool | _NotSetType = NotSet, has_discussions: bool | _NotSetType = NotSet, is_template: bool | _NotSetType = NotSet, default_branch: str | _NotSetType = NotSet, allow_squash_merge: bool | _NotSetType = NotSet, allow_merge_commit: bool | _NotSetType = NotSet, allow_rebase_merge: bool | _NotSetType = NotSet, allow_auto_merge: bool | _NotSetType = NotSet, delete_branch_on_merge: bool | _NotSetType = NotSet, allow_update_branch: bool | _NotSetType = NotSet, use_squash_pr_title_as_default: bool | _NotSetType = NotSet, squash_merge_commit_title: str | _NotSetType = NotSet, squash_merge_commit_message: str | _NotSetType = NotSet, merge_commit_title: str | _NotSetType = NotSet, merge_commit_message: str | _NotSetType = NotSet, archived: bool | _NotSetType = NotSet, allow_forking: bool | _NotSetType = NotSet, web_commit_signoff_required: bool | _NotSetType = NotSet) None
Calls:

PATCH /repos/{owner}/{repo}

Calls:

GET /repos/{owner}/{repo}/{archive_format}/{ref}

Parameters:
  • archive_format – string

  • ref – string

Return type:

string

get_assignees() PaginatedList[NamedUser]
Calls:

GET /repos/{owner}/{repo}/assignees

Return type:

PaginatedList of github.NamedUser.NamedUser

get_branch(branch: str) Branch
Calls:

GET /repos/{owner}/{repo}/branches/{branch}

Parameters:

branch – string

Return type:

github.Branch.Branch

rename_branch(branch: str | Branch, new_name: str) bool
Calls:

POST /repos/{owner}/{repo}/branches/{branch}/rename

Parameters:
Return type:

bool

NOTE: This method does not return the branch since it may take some time to fully complete server-side.

get_branches() PaginatedList[Branch]
Calls:

GET /repos/{owner}/{repo}/branches

Return type:

PaginatedList of github.Branch.Branch

get_collaborators(affiliation: Opt[str] = NotSet, permission: Opt[str] = NotSet) PaginatedList[NamedUser]
Calls:

GET /repos/{owner}/{repo}/collaborators

Parameters:
  • affiliation – string

  • permission – string

Return type:

PaginatedList of github.NamedUser.NamedUser

get_comment(id: int) CommitComment
Calls:

GET /repos/{owner}/{repo}/comments/{comment_id}

Parameters:

id – integer

Return type:

github.CommitComment.CommitComment

get_comments() PaginatedList[CommitComment]
Calls:

GET /repos/{owner}/{repo}/comments

Return type:

PaginatedList of github.CommitComment.CommitComment

get_commit(sha: str) Commit
Calls:

GET /repos/{owner}/{repo}/commits/{ref}

Parameters:

sha – string

Return type:

github.Commit.Commit

get_commits(sha: Opt[str] = NotSet, path: Opt[str] = NotSet, since: Opt[datetime] = NotSet, until: Opt[datetime] = NotSet, author: Opt[AuthenticatedUser | NamedUser | str] = NotSet) PaginatedList[Commit]
Calls:

GET /repos/{owner}/{repo}/commits

Parameters:
Return type:

PaginatedList of github.Commit.Commit

get_contents(path: str, ref: Opt[str] = NotSet) list[ContentFile] | ContentFile
Calls:

GET /repos/{owner}/{repo}/contents/{path}

Parameters:
  • path – string

  • ref – string

Return type:

github.ContentFile.ContentFile or a list of them

get_deployments(sha: Opt[str] = NotSet, ref: Opt[str] = NotSet, task: Opt[str] = NotSet, environment: Opt[str] = NotSet) PaginatedList[Deployment]
Calls:

GET /repos/{owner}/{repo}/deployments

Param:

sha: string

Param:

ref: string

Param:

task: string

Param:

environment: string

Return type:

PaginatedList of github.Deployment.Deployment

get_deployment(id_: int) Deployment
Calls:

GET /repos/{owner}/{repo}/deployments/{deployment_id}

Param:

id: int

Return type:

github.Deployment.Deployment

create_deployment(ref: str, task: Opt[str] = NotSet, auto_merge: Opt[bool] = NotSet, required_contexts: Opt[list[str]] = NotSet, payload: Opt[dict[str, Any]] = NotSet, environment: Opt[str] = NotSet, description: Opt[str] = NotSet, transient_environment: Opt[bool] = NotSet, production_environment: Opt[bool] = NotSet) Deployment
Calls:

POST /repos/{owner}/{repo}/deployments

Param:

ref: string

Param:

task: string

Param:

auto_merge: bool

Param:

required_contexts: list of status contexts

Param:

payload: dict

Param:

environment: string

Param:

description: string

Param:

transient_environment: bool

Param:

production_environment: bool

Return type:

github.Deployment.Deployment

get_top_referrers() None | list[Referrer]
Calls:

GET /repos/{owner}/{repo}/traffic/popular/referrers

get_top_paths() None | list[Path]
Calls:

GET /repos/{owner}/{repo}/traffic/popular/paths

Return type:

list of github.Path.Path

get_views_traffic(per: Opt[str] = NotSet) View | None
Calls:

GET /repos/{owner}/{repo}/traffic/views

Parameters:

per – string, must be one of day or week, day by default

Return type:

None or list of github.View.View

get_clones_traffic(per: Opt[str] = NotSet) Clones | None
Calls:

GET /repos/{owner}/{repo}/traffic/clones

Parameters:

per – string, must be one of day or week, day by default

Return type:

None or list of github.Clones.Clones

get_projects(state: Opt[str] = NotSet) PaginatedList[Project]
Calls:

GET /repos/{owner}/{repo}/projects

Return type:

PaginatedList of github.Project.Project

Parameters:

state – string

Calls:

GET /repos/{owner}/{repo}/autolinks

Return type:

PaginatedList of github.Autolink.Autolink

create_file(path: str, message: str, content: str | bytes, branch: Opt[str] = NotSet, committer: Opt[InputGitAuthor] = NotSet, author: Opt[InputGitAuthor] = NotSet) dict[str, ContentFile | Commit]

Create a file in this repository.

Calls:

`PUT /repos/{owner}/{repo}/contents/{path} <https://docs.github.com/en/rest/reference/repos#create-or-

update-file-contents>`_ :param path: string, (required), path of the file in the repository :param message: string, (required), commit message :param content: string, (required), the actual data in the file :param branch: string, (optional), branch to create the commit on. Defaults to the default branch of the

repository

Parameters:
  • committer – InputGitAuthor, (optional), if no information is given the authenticated user’s information will be used. You must specify both a name and email.

  • author – InputGitAuthor, (optional), if omitted this will be filled in with committer information. If passed, you must specify both a name and email.

Return type:

{ ‘content’: ContentFile:, ‘commit’: Commit}

get_repository_advisories() PaginatedList[RepositoryAdvisory]
Calls:

GET /repos/{owner}/{repo}/security-advisories

Return type:

PaginatedList of github.RepositoryAdvisory.RepositoryAdvisory

get_repository_advisory(ghsa: str) RepositoryAdvisory
Calls:

GET /repos/{owner}/{repo}/security-advisories/{ghsa_id}

Parameters:

ghsa – string

Return type:

github.RepositoryAdvisory.RepositoryAdvisory

update_file(path: str, message: str, content: bytes | str, sha: str, branch: Opt[str] = NotSet, committer: Opt[InputGitAuthor] = NotSet, author: Opt[InputGitAuthor] = NotSet) dict[str, ContentFile | Commit]

This method updates a file in a repository.

Calls:

`PUT /repos/{owner}/{repo}/contents/{path} <https://docs.github.com/en/rest/reference/repos#create-or-

update-file-contents>`_ :param path: string, Required. The content path. :param message: string, Required. The commit message. :param content: string, Required. The updated file content, either base64 encoded, or ready to be encoded. :param sha: string, Required. The blob SHA of the file being replaced. :param branch: string. The branch name. Default: the repository’s default branch (usually master) :param committer: InputGitAuthor, (optional), if no information is given the authenticated user’s information

will be used. You must specify both a name and email.

Parameters:

author – InputGitAuthor, (optional), if omitted this will be filled in with committer information. If passed, you must specify both a name and email.

Return type:

{ ‘content’: ContentFile:, ‘commit’: Commit}

delete_file(path: str, message: str, sha: str, branch: Opt[str] = NotSet, committer: Opt[InputGitAuthor] = NotSet, author: Opt[InputGitAuthor] = NotSet) dict[str, Commit | _NotSetType]

This method deletes a file in a repository.

Calls:

`DELETE /repos/{owner}/{repo}/contents/{path} <https://docs.github.com/en/rest/reference/repos#delete-a-

file>`_ :param path: string, Required. The content path. :param message: string, Required. The commit message. :param sha: string, Required. The blob SHA of the file being replaced. :param branch: string. The branch name. Default: the repository’s default branch (usually master) :param committer: InputGitAuthor, (optional), if no information is given the authenticated user’s information

will be used. You must specify both a name and email.

Parameters:

author – InputGitAuthor, (optional), if omitted this will be filled in with committer information. If passed, you must specify both a name and email.

Return type:

{ ‘content’: null:, ‘commit’: Commit}

get_dir_contents(path: str, ref: Opt[str] = NotSet) list[ContentFile]
Calls:

GET /repos/{owner}/{repo}/contents/{path}

get_contributors(anon: Opt[str] = NotSet) PaginatedList[NamedUser]
Calls:

GET /repos/{owner}/{repo}/contributors

Parameters:

anon – string

Return type:

PaginatedList of github.NamedUser.NamedUser

get_download(id: int) Download
Calls:

GET /repos/{owner}/{repo}/downloads/{id}

Parameters:

id – integer

Return type:

github.Download.Download

get_downloads() PaginatedList[Download]
Calls:

GET /repos/{owner}/{repo}/downloads

Return type:

PaginatedList of github.Download.Download

get_events() PaginatedList[Event]
Calls:

GET /repos/{owner}/{repo}/events

Return type:

PaginatedList of github.Event.Event

get_forks() PaginatedList[Repository]
Calls:

GET /repos/{owner}/{repo}/forks

Return type:

PaginatedList of github.Repository.Repository

create_fork(organization: Organization | Opt[str] = NotSet, name: Opt[str] = NotSet, default_branch_only: Opt[bool] = NotSet) Repository
Calls:

POST /repos/{owner}/{repo}/forks

Parameters:
Return type:

github.Repository.Repository

get_git_blob(sha: str) GitBlob
Calls:

GET /repos/{owner}/{repo}/git/blobs/{file_sha}

Parameters:

sha – string

Return type:

github.GitBlob.GitBlob

get_git_commit(sha: str) GitCommit
Calls:

GET /repos/{owner}/{repo}/git/commits/{commit_sha}

Parameters:

sha – string

Return type:

github.GitCommit.GitCommit

get_git_ref(ref: str) GitRef
Calls:

GET /repos/{owner}/{repo}/git/ref/{ref}

Parameters:

ref – string

Return type:

github.GitRef.GitRef

get_git_refs() PaginatedList[GitRef]
Calls:

GET /repos/{owner}/{repo}/git/refs

Return type:

PaginatedList of github.GitRef.GitRef

get_git_matching_refs(ref: str) PaginatedList[GitRef]
Calls:

GET /repos/{owner}/{repo}/git/matching-refs/{ref}

Return type:

PaginatedList of github.GitRef.GitRef

get_git_tag(sha: str) GitTag
Calls:

GET /repos/{owner}/{repo}/git/tags/{tag_sha}

Parameters:

sha – string

Return type:

github.GitTag.GitTag

get_git_tree(sha: str, recursive: Opt[bool] = NotSet) GitTree
Calls:

GET /repos/{owner}/{repo}/git/trees/{tree_sha}

Parameters:
  • sha – string

  • recursive – bool

Return type:

github.GitTree.GitTree

get_hook(id: int) Hook
Calls:

GET /repos/{owner}/{repo}/hooks/{hook_id}

Parameters:

id – integer

Return type:

github.Hook.Hook

get_hooks() PaginatedList[Hook]
Calls:

GET /repos/{owner}/{repo}/hooks

Return type:

PaginatedList of github.Hook.Hook

get_hook_delivery(hook_id: int, delivery_id: int) HookDelivery
Calls:

GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}

Parameters:
  • hook_id – integer

  • delivery_id – integer

Return type:

github.HookDelivery.HookDelivery

get_hook_deliveries(hook_id: int) PaginatedList[HookDeliverySummary]
Calls:

GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries

Parameters:

hook_id – integer

Return type:

PaginatedList of github.HookDelivery.HookDeliverySummary

get_issue(number: int) Issue
Calls:

GET /repos/{owner}/{repo}/issues/{issue_number}

Parameters:

number – integer

Return type:

github.Issue.Issue

get_issues(milestone: Milestone | Opt[str] = NotSet, state: Opt[str] = NotSet, assignee: NamedUser | Opt[str] = NotSet, mentioned: Opt[NamedUser] = NotSet, labels: Opt[list[str] | list[Label]] = NotSet, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet, since: Opt[datetime] = NotSet, creator: Opt[NamedUser] = NotSet, type: Opt[str] = NotSet) PaginatedList[Issue]
Calls:

GET /repos/{owner}/{repo}/issues

Parameters:
  • milestonegithub.Milestone.Milestone or “none” or “*”

  • state – string. open, closed, or all. If this is not set the GitHub API default behavior will be used. At the moment this is to return only open issues. This might change anytime on GitHub API side and it could be clever to explicitly specify the state value.

  • assignee – string or github.NamedUser.NamedUser or “none” or “*”

  • mentionedgithub.NamedUser.NamedUser

  • labels – list of string or github.Label.Label

  • sort – string

  • direction – string

  • since – datetime

  • creator – string or github.NamedUser.NamedUser

  • type – string

Return type:

PaginatedList of github.Issue.Issue

get_issues_comments(sort: Opt[str] = NotSet, direction: Opt[str] = NotSet, since: Opt[datetime] = NotSet) PaginatedList[IssueComment]
Calls:

GET /repos/{owner}/{repo}/issues/comments

Parameters:
  • sort – string

  • direction – string

  • since – datetime

Return type:

PaginatedList of github.IssueComment.IssueComment

get_issues_event(id: int) IssueEvent
Calls:

GET /repos/{owner}/{repo}/issues/events/{event_id}

Parameters:

id – integer

Return type:

github.IssueEvent.IssueEvent

get_issues_events() PaginatedList[IssueEvent]
Calls:

GET /repos/{owner}/{repo}/issues/events

Return type:

PaginatedList of github.IssueEvent.IssueEvent

get_key(id: int) RepositoryKey
Calls:

GET /repos/{owner}/{repo}/keys/{key_id}

Parameters:

id – integer

Return type:

github.RepositoryKey.RepositoryKey

get_keys() PaginatedList[RepositoryKey]
Calls:

GET /repos/{owner}/{repo}/keys

Return type:

PaginatedList of github.RepositoryKey.RepositoryKey

get_label(name: str) Label
Calls:

GET /repos/{owner}/{repo}/labels/{name}

Parameters:

name – string

Return type:

github.Label.Label

get_labels() PaginatedList[Label]
Calls:

GET /repos/{owner}/{repo}/labels

Return type:

PaginatedList of github.Label.Label

get_languages() dict[str, int]
Calls:

GET /repos/{owner}/{repo}/languages

Return type:

dict of string to integer

get_license() ContentFile
Calls:

GET /repos/{owner}/{repo}/license

Return type:

github.ContentFile.ContentFile

get_milestone(number: int) Milestone
Calls:

GET /repos/{owner}/{repo}/milestones/{milestone_number}

Parameters:

number – integer

Return type:

github.Milestone.Milestone

get_milestones(state: Opt[str] = NotSet, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet) PaginatedList[Milestone]
Calls:

GET /repos/{owner}/{repo}/milestones

Parameters:
  • state – string

  • sort – string

  • direction – string

Return type:

PaginatedList of github.Milestone.Milestone

get_network_events() PaginatedList[Event]
Calls:

GET /networks/{owner}/{repo}/events

Return type:

PaginatedList of github.Event.Event

get_public_key(secret_type: str = 'actions') PublicKey
Calls:

GET /repos/{owner}/{repo}/actions/secrets/public-key

Calls:

GET /repos/{owner}/{repo}/dependabot/secrets/public-key

Parameters:

secret_type – string options actions or dependabot

Return type:

github.PublicKey.PublicKey

get_pull(number: int) PullRequest
Calls:

GET /repos/{owner}/{repo}/pulls/{pull_number}

Parameters:

number – integer

Return type:

github.PullRequest.PullRequest

get_pulls(state: Opt[str] = NotSet, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet, base: Opt[str] = NotSet, head: Opt[str] = NotSet) PaginatedList[PullRequest]
Calls:

GET /repos/{owner}/{repo}/pulls

Parameters:
  • state – string

  • sort – string

  • direction – string

  • base – string

  • head – string

Return type:

PaginatedList of github.PullRequest.PullRequest

get_pulls_comments(sort: Opt[str] = NotSet, direction: Opt[str] = NotSet, since: Opt[datetime] = NotSet) PaginatedList[PullRequestComment]
Calls:

GET /repos/{owner}/{repo}/pulls/comments

Parameters:
  • sort – string

  • direction – string

  • since – datetime

Return type:

PaginatedList of github.PullRequestComment.PullRequestComment

get_pulls_review_comments(sort: Opt[str] = NotSet, direction: Opt[str] = NotSet, since: Opt[datetime] = NotSet) PaginatedList[PullRequestComment]
Calls:

GET /repos/{owner}/{repo}/pulls/comments:

Parameters:
  • sort – string ‘created’, ‘updated’, ‘created_at’

  • direction – string ‘asc’ or ‘desc’

  • since – datetime

Return type:

PaginatedList of github.PullRequestComment.PullRequestComment

get_readme(ref: Opt[str] = NotSet) ContentFile
Calls:

GET /repos/{owner}/{repo}/readme

Parameters:

ref – string

Return type:

github.ContentFile.ContentFile

get_self_hosted_runner(runner_id: int) SelfHostedActionsRunner
Calls:

GET /repos/{owner}/{repo}/actions/runners/{runner_id}

Parameters:

runner_id – int

Return type:

github.SelfHostedActionsRunner.SelfHostedActionsRunner

get_self_hosted_runners() PaginatedList[SelfHostedActionsRunner]
Calls:

GET /repos/{owner}/{repo}/actions/runners

Return type:

PaginatedList of github.SelfHostedActionsRunner.SelfHostedActionsRunner

get_source_import() SourceImport | None
Calls:

GET /repos/{owner}/{repo}/import

get_stargazers() PaginatedList[NamedUser]
Calls:

GET /repos/{owner}/{repo}/stargazers

Return type:

PaginatedList of github.NamedUser.NamedUser

get_stargazers_with_dates() PaginatedList[Stargazer]
Calls:

GET /repos/{owner}/{repo}/stargazers

Return type:

PaginatedList of github.Stargazer.Stargazer

get_stats_contributors() list[StatsContributor] | None
Calls:

GET /repos/{owner}/{repo}/stats/contributors

Return type:

None or list of github.StatsContributor.StatsContributor

get_stats_commit_activity() list[StatsCommitActivity] | None
Calls:

GET /repos/{owner}/{repo}/stats/commit_activity

Return type:

None or list of github.StatsCommitActivity.StatsCommitActivity

get_stats_code_frequency() list[StatsCodeFrequency] | None
Calls:

GET /repos/{owner}/{repo}/stats/code_frequency

Return type:

None or list of github.StatsCodeFrequency.StatsCodeFrequency

get_stats_participation() StatsParticipation | None
Calls:

GET /repos/{owner}/{repo}/stats/participation

Return type:

None or github.StatsParticipation.StatsParticipation

get_stats_punch_card() StatsPunchCard | None
Calls:

GET /repos/{owner}/{repo}/stats/punch_card

Return type:

None or github.StatsPunchCard.StatsPunchCard

get_subscribers() PaginatedList[NamedUser]
Calls:

GET /repos/{owner}/{repo}/subscribers

Return type:

PaginatedList of github.NamedUser.NamedUser

get_tags() PaginatedList[Tag]
Calls:

GET /repos/{owner}/{repo}/tags

Return type:

PaginatedList of github.Tag.Tag

get_releases() PaginatedList[GitRelease]
Calls:

GET /repos/{owner}/{repo}/releases

Return type:

PaginatedList of github.GitRelease.GitRelease

get_release(id: int | str) GitRelease
Calls:

GET /repos/{owner}/{repo}/releases/{release_id}

Parameters:

id – int (release id), str (tag name)

Return type:

None or github.GitRelease.GitRelease

get_latest_release() GitRelease
Calls:

GET /repos/{owner}/{repo}/releases/latest

Return type:

github.GitRelease.GitRelease

get_teams() PaginatedList[Team]
Calls:

GET /repos/{owner}/{repo}/teams

Return type:

PaginatedList of github.Team.Team

get_topics() list[str]
Calls:

GET /repos/{owner}/{repo}/topics

Return type:

list of strings

get_watchers() PaginatedList[NamedUser]
Calls:

GET /repos/{owner}/{repo}/watchers

Return type:

PaginatedList of github.NamedUser.NamedUser

get_workflows() PaginatedList[Workflow]
Calls:

GET /repos/{owner}/{repo}/actions/workflows

Return type:

PaginatedList of github.Workflow.Workflow

get_workflow(id_or_file_name: str | int) Workflow
Calls:

GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}

Parameters:

id_or_file_name – int or string. Can be either a workflow ID or a filename.

Return type:

github.Workflow.Workflow

get_workflow_runs(actor: Opt[NamedUser] = NotSet, branch: Opt[Branch] = NotSet, event: Opt[str] = NotSet, status: Opt[str] = NotSet, exclude_pull_requests: Opt[bool] = NotSet, head_sha: Opt[str] = NotSet, created: Opt[str] = NotSet, check_suite_id: Opt[int] = NotSet) PaginatedList[WorkflowRun]
Calls:

GET /repos/{owner}/{repo}/actions/runs

Parameters:
Return type:

PaginatedList of github.WorkflowRun.WorkflowRun

get_workflow_run(id_: int) WorkflowRun
Calls:

GET /repos/{owner}/{repo}/actions/runs/{run_id}

Parameters:

id – int

Return type:

github.WorkflowRun.WorkflowRun

has_in_assignees(assignee: str | NamedUser) bool
Calls:

GET /repos/{owner}/{repo}/assignees/{assignee}

Parameters:

assignee – string or github.NamedUser.NamedUser

Return type:

bool

has_in_collaborators(collaborator: str | NamedUser) bool
Calls:

GET /repos/{owner}/{repo}/collaborators/{username}

Parameters:

collaborator – string or github.NamedUser.NamedUser

Return type:

bool

legacy_search_issues(state: str, keyword: str) list[Issue]
Calls:

GET /legacy/issues/search/{owner}/{repository}/{state}/{keyword}

Parameters:
  • state – “open” or “closed”

  • keyword – string

Return type:

List of github.Issue.Issue

get_notifications(all: Opt[bool] = NotSet, participating: Opt[bool] = NotSet, since: Opt[datetime] = NotSet, before: Opt[datetime] = NotSet) PaginatedList[Notification]
Calls:

GET /repos/{owner}/{repo}/notifications

Parameters:
  • all – bool

  • participating – bool

  • since – datetime

  • before – datetime

Return type:

PaginatedList of github.Notification.Notification

mark_notifications_as_read(last_read_at: datetime = datetime.datetime(2025, 11, 20, 10, 0, 33, 466935, tzinfo=datetime.timezone.utc)) None
Calls:

PUT /repos/{owner}/{repo}/notifications

Parameters:

last_read_at – datetime

merge(base: str, head: str, commit_message: Opt[str] = NotSet) Commit | None
Calls:

POST /repos/{owner}/{repo}/merges

Parameters:
  • base – string

  • head – string

  • commit_message – string

Return type:

github.Commit.Commit

merge_upstream(branch: str) MergedUpstream
Calls:

POST /repos/{owner}/{repo}/merge-upstream

Parameters:

branch – string

Return type:

github.MergedUpstream.MergedUpstream

Raises:

GithubException for error status codes

replace_topics(topics: list[str]) None
Calls:

PUT /repos/{owner}/{repo}/topics

Parameters:

topics – list of strings

Return type:

None

get_vulnerability_alert() bool
Calls:

GET /repos/{owner}/{repo}/vulnerability-alerts

Return type:

bool

enable_vulnerability_alert() bool
Calls:

PUT /repos/{owner}/{repo}/vulnerability-alerts

Return type:

bool

disable_vulnerability_alert() bool
Calls:

DELETE /repos/{owner}/{repo}/vulnerability-alerts

Return type:

bool

get_automated_security_fixes() dict[str, bool]
Calls:

GET /repos/{owner}/{repo}/automated-security-fixes

Return type:

dict

enable_automated_security_fixes() bool
Calls:

PUT /repos/{owner}/{repo}/automated-security-fixes

Return type:

bool

disable_automated_security_fixes() bool
Calls:

DELETE /repos/{owner}/{repo}/automated-security-fixes

Return type:

bool

remove_from_collaborators(collaborator: str | NamedUser) None
Calls:

DELETE /repos/{owner}/{repo}/collaborators/{username}

Parameters:

collaborator – string or github.NamedUser.NamedUser

Return type:

None

remove_self_hosted_runner(runner: SelfHostedActionsRunner | int) bool
Calls:

DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}

Parameters:

runner – int or github.SelfHostedActionsRunner.SelfHostedActionsRunner

Return type:

bool

Calls:

DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}

Parameters:

autolink – int or github.Autolink.Autolink

Return type:

None

subscribe_to_hub(event: str, callback: str, secret: str | _NotSetType = NotSet) None
Calls:

POST /hub

Parameters:
  • event – string

  • callback – string

  • secret – string

Return type:

None

unsubscribe_from_hub(event: str, callback: str) None
Calls:

POST /hub

Parameters:
  • event – string

  • callback – string

  • secret – string

Return type:

None

create_check_suite(head_sha: str) CheckSuite
Calls:

POST /repos/{owner}/{repo}/check-suites

Parameters:

head_sha – string

Return type:

github.CheckSuite.CheckSuite

get_check_suite(check_suite_id: int) CheckSuite
Calls:

GET /repos/{owner}/{repo}/check-suites/{check_suite_id}

Parameters:

check_suite_id – int

Return type:

github.CheckSuite.CheckSuite

update_check_suites_preferences(auto_trigger_checks: list[dict[str, bool | int]]) RepositoryPreferences
Calls:

PATCH /repos/{owner}/{repo}/check-suites/preferences

Parameters:

auto_trigger_checks – list of dict

Return type:

github.RepositoryPreferences.RepositoryPreferences

create_check_run(name: str, head_sha: str, details_url: Opt[str] = NotSet, external_id: Opt[str] = NotSet, status: Opt[str] = NotSet, started_at: Opt[datetime] = NotSet, conclusion: Opt[str] = NotSet, completed_at: Opt[datetime] = NotSet, output: Opt[dict[str, str | list[dict[str, str | int]]]] = NotSet, actions: Opt[list[dict[str, str]]] = NotSet) CheckRun
Calls:

POST /repos/{owner}/{repo}/check-runs

Parameters:
  • name – string

  • head_sha – string

  • details_url – string

  • external_id – string

  • status – string

  • started_at – datetime

  • conclusion – string

  • completed_at – datetime

  • output – dict

  • actions – list of dict

Return type:

github.CheckRun.CheckRun

get_check_run(check_run_id: int) CheckRun
Calls:

GET /repos/{owner}/{repo}/check-runs/{check_run_id}

Parameters:

check_run_id – int

Return type:

github.CheckRun.CheckRun

get_artifacts(name: Opt[str] = NotSet) PaginatedList[Artifact]
Calls:

GET /repos/{owner}/{repo}/actions/artifacts

Parameters:

name – str

Return type:

PaginatedList of github.Artifact.Artifact

get_artifact(artifact_id: int) Artifact
Calls:

GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}

Parameters:

artifact_id – int

Return type:

github.Artifact.Artifact

get_codescan_alerts() PaginatedList[CodeScanAlert]
Calls:

GET /repos/{owner}/{repo}/code-scanning/alerts

Return type:

PaginatedList of github.CodeScanAlert.CodeScanAlert

get_environments() PaginatedList[Environment]
Calls:

GET /repos/{owner}/{repo}/environments

Return type:

PaginatedList of github.Environment.Environment

get_environment(environment_name: str) Environment
Calls:

GET /repos/{owner}/{repo}/environments/{environment_name}

Return type:

github.Environment.Environment

create_environment(environment_name: str, wait_timer: int = 0, reviewers: list[ReviewerParams] = [], prevent_self_review: bool = False, deployment_branch_policy: EnvironmentDeploymentBranchPolicyParams | None = None) Environment
Calls:

PUT /repos/{owner}/{repo}/environments/{environment_name}

Parameters:
  • environment_name – string

  • wait_timer – int

  • reviewers – List[:class:github.EnvironmentDeploymentBranchPolicy.EnvironmentDeploymentBranchPolicyParams]

  • prevent_self_review – bool

  • deployment_branch_policy – Optional[:class:github.EnvironmentDeploymentBranchPolicy.EnvironmentDeploymentBranchPolicyParams`]

Return type:

github.Environment.Environment

delete_environment(environment_name: str) None
Calls:

DELETE /repos/{owner}/{repo}/environments/{environment_name}

Parameters:

environment_name – string

Return type:

None

get_dependabot_alerts(state: Opt[str] = NotSet, severity: Opt[str] = NotSet, ecosystem: Opt[str] = NotSet, package: Opt[str] = NotSet, manifest: Opt[str] = NotSet, scope: Opt[str] = NotSet, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet) PaginatedList[DependabotAlert]
Calls:

GET /repos/{owner}/{repo}/dependabot/alerts

Parameters:
  • state – Optional string

  • severity – Optional string

  • ecosystem – Optional string

  • package – Optional string

  • manifest – Optional string

  • scope – Optional string

  • sort – Optional string

  • direction – Optional string

Return type:

PaginatedList of github.DependabotAlert.DependabotAlert

get_dependabot_alert(number: int) DependabotAlert
Calls:

GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number}

Parameters:

number – int

Return type:

github.DependabotAlert.DependabotAlert

update_dependabot_alert(number: int, state: str, dismissed_reason: Opt[str] = NotSet, dismissed_comment: Opt[str] = NotSet) DependabotAlert
Calls:

PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number}

Parameters:
  • number – int

  • state – string

  • dismissed_reason – Optional string

  • dismissed_comment – Optional string

Return type:

github.DependabotAlert.DependabotAlert

get_custom_properties() dict[str, None | str | list]
Calls:

GET /repos/{owner}/{repo}/properties/values

Return type:

dict[str, None | str | list]

update_custom_properties(properties: dict[str, None | str | list]) None
Calls:

PATCH /repos/{owner}/{repo}/properties/values

Return type:

None

attach_security_config(id: int) None
Calls:

POST /orgs/{org}/code-security/configurations/{configuration_id}/attach

detach_security_config() None
Calls:

DELETE /orgs/{org}/code-security/configurations/detach

get_security_config() RepoCodeSecurityConfig | None
Calls:

GET /repos/{owner}/{repo}/code-security-configuration

Return type:

RepoCodeSecurityConfig | None

transfer_ownership(new_owner: str, new_name: str | _NotSetType = NotSet, teams: list[int] | _NotSetType = NotSet) bool
Calls:

POST /repos/{owner}/{repo}/transfer

Parameters:
  • new_owner – string

  • new_name – Optional string

  • teams – Optional list of int

Return type:

bool