GitHub¶
github
¶
Functions:
| Name | Description |
|---|---|
fetch_branch_zip |
Download the latest zipball of a repository branch from GitHub. |
get_latest_workflow_run |
Fetch the most recent GitHub Actions workflow run for a repository. |
fetch_branch_zip
¶
fetch_branch_zip(owner: str, repo: str, branch: str, out_dir: str, token: Optional[str] = None, extract: bool = True) -> Tuple[str, Optional[str]]
Download the latest zipball of a repository branch from GitHub.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Repository owner (user or organisation). |
required |
|
str
|
Repository name. |
required |
|
str
|
Branch name to download. |
required |
|
str
|
Local directory where the zip file (and extracted content) will be written. |
required |
|
Optional[str]
|
GitHub personal access token for private repositories. Defaults to None. |
None
|
|
bool
|
If True, extract the zip after downloading. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Tuple of (zip_file_path, extracted_root_dir_or_None). The second element is |
Optional[str]
|
None when extract is False. |
Source code in oops/services/github.py
get_latest_workflow_run
¶
get_latest_workflow_run(owner: str, repo: str, token: str, branch: Optional[str] = None) -> Optional[WorkflowRunInfo]
Fetch the most recent GitHub Actions workflow run for a repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Repository owner (user or organisation). |
required |
|
str
|
Repository name. |
required |
|
str
|
GitHub personal access token. |
required |
|
Optional[str]
|
If provided, filter runs to this branch. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[WorkflowRunInfo]
|
WorkflowRunInfo for the latest run, or None if parsing fails. |