Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# semantic_release.hvcs.gitea module

Helper code for interacting with a Gitea remote VCS

class semantic_release.hvcs.gitea.Gitea(remote_url: str, *, hvcs_domain: str | None = None, token: str | None = None, allow_insecure: bool = False, **_kwargs: Any)

  Bases: `RemoteHvcsBase`

  Gitea helper class

  DEFAULT_API_PATH = '/api/v1'
  DEFAULT_DOMAIN = 'gitea.com'
  DEFAULT_ENV_TOKEN_NAME = 'GITEA_TOKEN'
  OFFICIAL_NAME = 'Gitea'
  asset_upload_url(release_id: str) → str

    Get the correct upload url for a release https://gitea.com/api/swagger#/repository/repoCreateReleaseAttachment :param release_id: ID of the release to upload to

  commit_hash_url(commit_hash: str) → str
  create_or_update_release(tag: str, release_notes: str, prerelease: bool = False) → int

    Post release changelog :param version: The version number :param changelog: The release notes for this version

    Returns:

      The status of the request

  create_release(tag: str, release_notes: str, prerelease: bool = False, assets: list[str] | None = None, noop: bool = False) → int

    Create a new release

    Ref: https://gitea.com/api/swagger#/repository/repoCreateRelease

    Parameters:

      - tag – Tag to create release for

      - release_notes – The release notes for this version

      - prerelease – Whether or not this release should be specified as a prerelease

    Returns:

      Whether the request succeeded

  create_release_url(tag: str = '') → str
  edit_release_notes(release_id: int, release_notes: str) → int

    Edit a release with updated change notes https://gitea.com/api/swagger#/repository/repoEditRelease :param id: ID of release to update :param release_notes: The release notes for this version

    Returns:

      The ID of the release that was edited

  static format_w_official_vcs_name(format_str: str) → str
  get_changelog_context_filters() → tuple[Callable[..., Any], ...]

    Return a list of functions that can be used as filters in a Jinja2 template

    ex. filters to convert text to URLs for issues and commits

  get_release_id_by_tag(tag: str) → int | None

    Get a release by its tag name https://gitea.com/api/swagger#/repository/repoGetReleaseByTag :param tag: Tag to get release for

    Returns:

      ID of found release

  issue_url(issue_num: str | int) → str
  pull_request_url(pr_number: str | int) → str
  remote_url(use_token: bool = True) → str

    Get the remote url including the token for authentication if requested

  upload_dists(tag: str, dist_glob: str) → int

    Upload distributions to a release :param tag: Tag to upload for :param path: Path to the dist directory

    Returns:

      The number of distributions successfully uploaded

  upload_release_asset(release_id: int, file: str, label: str | None = None) → bool

    Upload an asset to an existing release https://gitea.com/api/swagger#/repository/repoCreateReleaseAttachment :param release_id: ID of the release to upload to :param file: Path of the file to upload :param label: this parameter has no effect

    Returns:

      The status of the request