action_utils.common module
Constants, classes, and utilities related to git/GitHub common across scripts
- exception action_utils.common.ConfigurationError
Bases:
Exception
Should be raised when input arguments are found to be incorrect/invalid
- exception action_utils.common.InvalidVersion
Bases:
Exception
Should be raised when parsing a tag that does not conform to expected version format
- class action_utils.common.VersionTag(tag: str)
Bases:
object
Representation of a git tag in the form of major.minor.patch-release
- assert_valid_new_version(other: VersionTag) None
Is the other VersionTag a valid increment of self? Asserts that the new version is >= the old version, that the minor and patch versions are 0 for a major increment, that the patch version is 0 for a minor increment, and that version increments are equal to 1.
- Parameters:
other – The VersionTag representing a version increment
- Raises:
InvalidVersion – If the given VersionTag is not a valid increment
- get_new_release() str
Return a new tag with the release number incremented by 1
- Returns:
The new tag string
- property major: int
The major version number
- property minor: int
The minor version number
- property patch: int
The patch version number
- property release: int
The release number
- property tag: str
The tag string
- action_utils.common.get_organization(client, org_name)
Wraps call to GitHub’s Organization REST endpoint in a try/except
- action_utils.common.get_pull(repo, pull_number)
Wraps call to GitHub’s Pulls REST endpoint in a try/except
- action_utils.common.get_repo(org, repo_name)
Wraps call to GitHub’s Repository REST endpoint in a try/except
- action_utils.common.get_repo_name(git_repo: git.repo.base.Repo) str
Given a GitPython Repo object, determine the name of the repository based on the remote
- Parameters:
git_repo – The Repo instance
- Returns:
The name of the repository
- action_utils.common.get_repo_name_from_url(url: str) str
Given a https/git url, get the repository name
- Parameters:
url – The url to parse, either https://github.com/… or git@github.com:…
- Returns:
The repository name parsed from the url
- action_utils.common.get_submodule_name(git_submodule: git.objects.submodule.base.Submodule) str
Given a GitPython Submodule object, determine the name of the submodule based on the remote
- Parameters:
git_submodule – The Submodule instance
- Returns:
The name of the repository