Commit

class github.Commit.Commit

This class represents Commits.

The reference can be found here https://docs.github.com/en/rest/commits/commits#get-a-commit

This class has a paginated property. For details, see Commit.files() or Commit.get_files().

The OpenAPI schema can be found at

  • /components/schemas/branch-short/properties/commit

  • /components/schemas/commit

  • /components/schemas/commit-search-result-item/properties/parents/items

  • /components/schemas/commit/properties/parents/items

  • /components/schemas/short-branch/properties/commit

  • /components/schemas/tag/properties/commit

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 files: PaginatedList[File]

This is a paginated property.

Iterating over this paginated list may fetch multiple pages. The size of these pages can be controlled via the …_per_page parameter of github.Repository.Repository.get_commit(), github.Commit.Commit.get_files(), or github.Github().

If no per_page is given, the default page size is 300. The maximum is 300.

At most 3000 files can be retrieved.

create_comment(body: str, line: Opt[int] = NotSet, path: Opt[str] = NotSet, position: Opt[int] = NotSet) CommitComment
Calls:

POST /repos/{owner}/{repo}/commits/{commit_sha}/comments

create_status(state: str, target_url: Opt[str] = NotSet, description: Opt[str] = NotSet, context: Opt[str] = NotSet) CommitStatus
Calls:

POST /repos/{owner}/{repo}/statuses/{sha}

get_branches_where_head() list[Branch]
Calls:

GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head

get_comments() PaginatedList[CommitComment]
Calls:

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

get_files(*, commit_files_per_page: int | None = None) PaginatedList[File]
Calls:

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

Identical to calling github.Commit.Commit.files(), except that this uses the given per_page value.

For more details, see github.Commit.Commit.files().

Parameters:

commit_files_per_page – int Number of files retrieved per page. Iterating over the files will fetch pages of this size. The default page size is 300, the maximum is 300. At most 3000 files can be retrieved.

get_statuses() PaginatedList[CommitStatus]
Calls:

GET /repos/{owner}/{repo}/statuses/{sha}

get_combined_status() CommitCombinedStatus
Calls:

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

get_pulls() PaginatedList[PullRequest]
Calls:

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

get_check_runs(check_name: Opt[str] = NotSet, status: Opt[str] = NotSet, filter: Opt[str] = NotSet) PaginatedList[CheckRun]
Calls:

GET /repos/{owner}/{repo}/commits/{ref}/check-runs

get_check_suites(app_id: Opt[int] = NotSet, check_name: Opt[str] = NotSet) PaginatedList[CheckSuite]
Class:

GET /repos/{owner}/{repo}/commits/{ref}/check-suites