dvcurator.github¶
Attributes¶
Functions¶
Check whether the running version is the same as the newest github tag |
|
|
Check whether github repository exists |
|
Check if a project has existing github tickets |
|
Wait for the workflow run that our dispatch just started. |
|
Dig the project number out of a completed run's log and build its URL. |
|
Trigger a "create a project" workflow in a GitHub repository. |
Module Contents¶
- dvcurator.github.github_api = 'https://api.github.com'¶
- dvcurator.github.check_version()¶
Check whether the running version is the same as the newest github tag
- Returns:
Whether a new update is available on github
- Return type:
boolean
- dvcurator.github.check_repo(key=None, repo=None)¶
Check whether github repository exists
- Parameters:
key (String or None) – Github API key, or None for public repository
repo (String or None) – Github repository path (e.g. QualitativeDataRepository/dvcurator-python), or None for default
- Returns:
Whether or not the repository is accessible
- Return type:
boolean
- dvcurator.github.search_existing(project_name, token=None, repo=None)¶
Check if a project has existing github tickets
- Parameters:
project_name (String) – Project name to check for existing tickets
token (String or None) – Github token key, or None for public repository
repo (String or None) – Github repository path (e.g. QualitativeDataRepository/dvcurator-python), or None for default
- Returns:
Whether or not there are any existing tickets with the specified project name
- Return type:
boolean
- dvcurator.github.wait_for_project_run(repo, headers, since, timeout=180)¶
Wait for the workflow run that our dispatch just started.
A workflow_dispatch returns no run id, so we look for the newest run created since we sent the request and then follow that one.
- Parameters:
repo (String) – Github repository path (e.g. QualitativeDataRepository/Project-Curation)
headers (dict) – Request headers, including the authorization token
since (datetime, timezone aware) – Ignore any run created before this
timeout (int) – Seconds to wait before giving up
- Returns:
The completed run, or None if it never finished
- Return type:
dict, or None
- dvcurator.github.project_url_from_run(repo, run, headers)¶
Dig the project number out of a completed run’s log and build its URL.
The workflow echoes “Made project number: N”, which is the only place the number is exposed to us.
- Parameters:
repo (String) – Github repository path
run (dict) – Completed run, as returned by wait_for_project_run()
headers (dict) – Request headers, including the authorization token
- Returns:
URL of the new project, or None if the log didn’t have it
- Return type:
String, or None
- dvcurator.github.create_project(dv, project_name, token, repo=None)¶
Trigger a “create a project” workflow in a GitHub repository.
- Parameters:
project_name (str) – The name of the project to be created.
token (str) – The GitHub API token for authentication.
repo (str, optional) – The repository where the project will be created. If not provided, the default repository will be used.
- Returns:
URL of the new project, or None if it wasn’t created
- Return type:
String, or None