ci
compare_sha_url(owner, repo, prev, nxt)
¶
Generate a url to compare two sha/tags in a github repo.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
owner |
str
|
The repo owner. |
required |
repo |
str
|
The repo name. |
required |
prev |
str
|
The previous sha. |
required |
nxt |
str
|
The next sha. |
required |
Returns:
Type | Description |
---|---|
str
|
A url comparing two shas. |
Source code in m/github/ci.py
create_ci_query(pr_number=None, include_commit=False, include_release=False)
¶
Create github graphql query.
The information provided is done via presets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pr_number |
int | None
|
If included, it will add pull request information. |
None
|
include_commit |
bool
|
If true, include commit information. |
False
|
include_release |
bool
|
If true, include release information. |
False
|
Returns:
Type | Description |
---|---|
str
|
A string with the graphql query. |
Source code in m/github/ci.py
get_build_sha(token, owner, repo, sha)
¶
Obtain the commit sha in a pull request.
When building prs, we are not given the actual sha of the commit.
Instead, we get the sha of the merge commit. This will give us the sha that we are looking for.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token |
str
|
A Github PAT. |
required |
owner |
str
|
The owner of the repo. |
required |
repo |
str
|
The name of the repo. |
required |
sha |
str
|
The merge sha provided by github. |
required |
Returns:
Type | Description |
---|---|
OneOf[Issue, str]
|
The actual sha of the commit. |
Source code in m/github/ci.py
get_ci_run_info(token, commit_info, pr_number, file_count, include_release)
¶
Transform the result from get_raw_ci_run_info to a GithubCiRunInfo.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token |
str
|
A Github PAT. |
required |
commit_info |
CommitInfo
|
An instance of a commit info. |
required |
pr_number |
int | None
|
An optional pull request number. |
required |
file_count |
int
|
The maximum number of files to report. |
required |
include_release |
bool
|
If true it will provide release information. |
required |
Returns:
Type | Description |
---|---|
OneOf[Issue, GithubCiRunInfo]
|
If successful, a |
Source code in m/github/ci.py
get_raw_ci_run_info(token, commit_info, pr_number, file_count, include_release, get_sha=True)
¶
Retrieve the information of the given Github PR.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token |
str
|
A Github PAT. |
required |
commit_info |
CommitInfo
|
The owner, repo and sha. |
required |
pr_number |
int | None
|
The pull request number. |
required |
file_count |
int
|
The maximum number of files in the pr to retrieve. |
required |
include_release |
bool
|
If true it will provide release information. |
required |
get_sha |
bool
|
If true, it will obtain the actual sha of the commit. |
True
|
Returns:
Type | Description |
---|---|
OneOf[Issue, Any]
|
The Github payload with the raw information. |