biosimulators_utils.gh_action package¶
Submodules¶
biosimulators_utils.gh_action.core module¶
Utilities for GitHub action workflows for reviewing and committing simulators to the BioSimulators registry
- Author
Jonathan Karr <karr@mssm.edu>
- Date
2020-12-08
- Copyright
2020, Center for Reproducible Biomedical Modeling
- License
MIT
- class biosimulators_utils.gh_action.core.GitHubAction[source]¶
Bases:
abc.ABC
A GitHub continuous integration action
- classmethod add_comment_to_issue(issue_number, comment)[source]¶
Post a comment to the GitHub issue
- Parameters
issue_number (
str
) – issue numbercomment (
str
) – comment
- classmethod add_error_comment_to_issue(issue_number, comments, raise_error=True)[source]¶
Post an error to the GitHub issue
- Parameters
issue_number (
str
) – issue numbercomments (
list
ofComment
) – commentraise_error (
bool
, optional) – ifTrue
, raise error
- Raises
ValueError –
- classmethod add_labels_to_issue(issue_number, labels)[source]¶
Add one or more labels to an issue
- Parameters
issue_number (
str
) – issue numberlabels (
list
ofstr
) – labels to add to the issue
- classmethod assign_issue(issue_number, users)[source]¶
Assign an issue to a list of users
- Parameters
issue_number (
str
) – issue numberusers (
list
ofstr
) – GitHub ids of users to assign to issue
- classmethod close_issue(issue_number)[source]¶
Close a GitHub issue
- Parameters
issue_number (
str
) – issue number
- classmethod format_error_comment(comment)[source]¶
Format comment to display as error
- Parameters
comment (
str
) – comment to format as error- Returns
formatted comment
- Return type
str
- static get_data_in_issue(issue)[source]¶
Get the YAML-structured data in an issue
- Parameters
issue (
dict
) – properties of the GitHub issue for the submission- Returns
YAML-structured data in an issue
- Return type
object
- static get_gh_action_run_id()[source]¶
Get the id for the current GitHub action run
- Returns
GitHub action run id
- Return type
str
- classmethod get_gh_action_run_url()[source]¶
Get the URL for a GitHub action run
- Returns
URL for a GitHub action run
- Return type
str
- static get_gh_auth()[source]¶
Get authorization for GitHub
- Returns
authorization for GitHub (user and access token)
- Return type
tuple
ofstr
- static get_gh_repo()[source]¶
Get the owner and name of the repository which triggered the action
- Returns
owner and name of the repository which triggered the action
- Return type
str
- classmethod get_issue(issue_number)[source]¶
Get the properties of the GitHub issue for the submission
- Parameters
issue_number (
str
) – issue number- Returns
properties of the GitHub issue for the submission
- Return type
dict
- static get_issue_number()[source]¶
Get the number of the issue which triggered the action
- Returns
issue number
- Return type
str
- classmethod get_labels_for_issue(issue_number)[source]¶
Get the labels for an issue
- Parameters
issue_number (
str
) – issue number- Returns
labels
- Return type
list
ofstr
- classmethod remove_label_from_issue(issue_number, label)[source]¶
Remove a label from an issue
- Parameters
issue_number (
str
) – issue numberlabel (
str
) – labels to add to the issue
- class biosimulators_utils.gh_action.core.GitHubActionErrorHandling[source]¶
Bases:
object
Methods for handing errors in the execution of GitHu actions
- classmethod catch_errors(uncaught_exception_msg_func=None, caught_error_labels=None, uncaught_error_labels=None)[source]¶
Generator for a decorator for CI actions that catches errors and reports them as comments to an issue
- Parameters
uncaught_exception_msg_func (
types.FunctionType
, optional) – function to calculate error message to display to userscaught_error_labels (
list
ofstr
, optional) – labels to apply to caught errorsuncaught_error_labels (
list
ofstr
, optional) – labels to apply to uncaught errors
- get_uncaught_exception_msg()[source]¶
Create an error message to display to users for all exceptions not caught during the exception of the
run
method for a GitHub action workflow (exceptions of all types exceptGitHubActionCaughtError
)- Parameters
exception (
Exception
) – a failure encountered during the exception of therun
method for the workflow- Returns
error message to display to users
- Return type
str
biosimulators_utils.gh_action.data_model module¶
Data model for GitHub action workflows
- Author
Jonathan Karr <karr@mssm.edu>
- Date
2020-12-08
- Copyright
2020, Center for Reproducible Biomedical Modeling
- License
MIT
- class biosimulators_utils.gh_action.data_model.Comment(text=None, error=None)[source]¶
Bases:
object
A comment on an issue
- exception biosimulators_utils.gh_action.data_model.GitHubActionCaughtError[source]¶
Bases:
biosimulators_utils.exceptions.BioSimulatorsException
An error caught during the execution of a GitHub action