github3_utils.check_labels
¶
Helpers for creating labels to mark pull requests with which tests are failing.
New in version 0.4.0.
Classes:
|
Represents the sets of status checks returned by |
|
Represents an issue or pull request label. |
Data:
Labels corresponding to failing pull request checks. |
Functions:
|
Returns a |
|
Labels the given pull request to indicate which checks are failing. |
-
namedtuple
Checks
(successful, failing, running, skipped, neutral)[source]¶ Bases:
NamedTuple
Represents the sets of status checks returned by
get_checks_for_pr()
.- Fields
-
__repr__
()¶ Return a nicely formatted representation string
-
class
Label
(name, color, description=None)[source]¶ Bases:
object
Represents an issue or pull request label.
- Parameters
Methods:
__repr__
()Return a string representation of the
Label
.__str__
()Return
str(self)
.create
(repo)Create this label on the given repository.
to_dict
()Return the
Label
as a dictionary.Attributes:
The background colour of the label.
A short description of the label.
The text of the label.
-
create
(repo)[source]¶ Create this label on the given repository.
- Parameters
repo (
Repository
)- Return type
-
check_status_labels
= {'failure: Linux': Label(name='failure: Linux', color='#F6BDC0', description='The Linux tests are failing.'), 'failure: Windows': Label(name='failure: Windows', color='#F07470', description='The Windows tests are failing.'), 'failure: docs': Label(name='failure: docs', color='#EA4C46', description='The docs check is failing.'), 'failure: flake8': Label(name='failure: flake8', color='#B60205', description='The Flake8 check is failing.'), 'failure: mypy': Label(name='failure: mypy', color='#DC1C13', description='The mypy check is failing.')}¶ -
Labels corresponding to failing pull request checks.
-
get_checks_for_pr
(pull)[source]¶ Returns a
Checks
object containing sets of check names grouped by their status.- Parameters
pull (
Union
[PullRequest
,ShortPullRequest
]) – The pull request to obtain checks for.- Return type
-
label_pr_failures
(pull)[source]¶ Labels the given pull request to indicate which checks are failing.
- Parameters
pull (
Union
[PullRequest
,ShortPullRequest
])- Return type
- Returns
The new labels set for the pull request.