GitRelease

class github.GitRelease.GitRelease

This class represents GitReleases.

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

The OpenAPI schema can be found at

  • /components/schemas/release

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

delete_release() None
Calls:

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

update_release(name: str, message: str, draft: bool = False, prerelease: bool = False, tag_name: str | _NotSetType = NotSet, target_commitish: str | _NotSetType = NotSet, make_latest: str | _NotSetType = NotSet, discussion_category_name: str | _NotSetType = NotSet) GitRelease
Calls:

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

upload_asset(path: str, label: str = '', content_type: Opt[str] = NotSet, name: Opt[str] = NotSet) GitReleaseAsset
Calls:

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

upload_asset_from_memory(file_like: BinaryIO, file_size: int, name: str, content_type: Opt[str] = NotSet, label: str = '') GitReleaseAsset

Uploads an asset.

Unlike upload_asset() this method allows you to pass in a file-like object to upload. Note that this method is more strict and requires you to specify the name, since there’s no file name to infer these from. :calls: POST /repos/{owner}/{repo}/releases/{release_id}/assets :param file_like: binary file-like object, such as those returned by open("file_name", "rb"). At the very minimum, this object must implement read(). :param file_size: int, size in bytes of file_like

get_assets() PaginatedList[GitReleaseAsset]
Calls:

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