GithubRepo (autotransform.repo.github)

The implementation for the GithubRepo.

class autotransform.repo.github.GithubRepo(*, base_branch: str, full_github_name: str, commit_repo: Optional[str] = None, hide_automation_info: bool = False, hide_autotransform_docs: bool = False, labels: List[str] = None, reviewers: List[str] = None, team_reviewers: List[str] = None)

Bases: GitRepo

A Repo that provides support for submitting changes as a pull request against a Github repo.

full_github_name

The fully qualified name of the Github Repo.

Type:

str

commit_repo

The repo from which to generate a Pull Request. Used if creating a Pull Request from a fork. Defaults to None.

Type:

optional, Optional[str]

hide_automation_info

Whether to hide information on how automation was done from the pull request body. Defaults to False.

Type:

bool, optional

hide_autotransform_docs

Whether to hide links to AutoTransform docs from the pull request body. Defaults to False.

Type:

bool, optional

labels

The labels to add to pull requests. Defaults to [].

Type:

List[str], optional

reviewers

The reviewers to request for pull requests. Defaults to [].

Type:

List[str], optional

team_reviewers

The team reviewers to request for pull requests. Defaults to [].

Type:

List[str], optional

name

The name of the component.

Type:

ClassVar[RepoName]

commit_repo: Optional[str]
full_github_name: str
get_automation_info(schema: Optional[AutoTransformSchema], batch: Batch) str

Gets information on automating with AutoTransform.

Parameters:
  • schema (Optional[AutoTransformSchema]) – The Schema making the Change.

  • batch (Batch) – The Batch the Change is being made for.

Returns:

The text for automating.

Return type:

str

get_outstanding_changes() Sequence[GithubChange]

Gets all outstanding pull requests for the Repo.

Returns:

The outstanding Changes against the Repo.

Return type:

Sequence[GithubChange]

has_outstanding_change(batch: Batch) bool

Checks the state of the repo to see whether an outstanding Change for the Batch exists.

Parameters:

batch (Batch) – The Batch to check for.

Returns:

Whether an outstanding Change exists.

Return type:

bool

hide_automation_info: bool
hide_autotransform_docs: bool
labels: List[str]
name: ClassVar[RepoName] = 'github'
reviewers: List[str]
submit(batch: Batch, _transform_data: Optional[Mapping[str, Any]], change: Optional[Change] = None) None

Performs the normal submit for a git repo then submits a pull request against the provided Github repo.

Parameters:
  • batch (Batch) – The Batch for which the changes were made.

  • _transform_data (Optional[Mapping[str, Any]]) – Data from the transformation. Unused.

  • change (Optional[Change]) – An associated change which should be updated. Defaults to None.

team_reviewers: List[str]
class autotransform.repo.github.GithubRepoBatchMetadata(*, body: str, labels: List[str] = None, reviewers: List[str] = None, team_reviewers: List[str] = None)

Bases: BaseModel

The metadata used by GithubRepo.

body

The body of the Pull Request to make.

Type:

str

labels

The labels to add to the Pull Request. Defaults to [].

Type:

optional, List[str]

reviewers

The reviewers to request for the Pull Request. Defaults to [].

Type:

optional, List[str]

team_reviewers

The team reviewers to request for the Pull Request. Defaults to [].

Type:

optional, List[str]

body: str
labels: List[str]
reviewers: List[str]
team_reviewers: List[str]