astra.utils.github

Module Contents

Functions

validate_slug(slug) Validate a given GitHub repository slug, given some input.
validate_repository_name(repository_name) Validate a given GitHub repository name.
get_authentication_token(token=None) Check the Astra configuration and the SDSS_GITHUB_KEY environment variables (in that order) for
graphql(query_string, token=None) Execute a GraphQL query on GitHub.
get_repository_summary(owner, repository, **kwargs) Return summary information about a GitHub repository using the GitHub
get_most_recent_release(owner, repository, n=1, **kwargs) Query the GitHub GraphQL API to access information about the most recent
astra.utils.github.validate_slug(slug)

Validate a given GitHub repository slug, given some input.

Parameters:slug – The given slug string, which should be in the form ‘{OWNER}/{REPO}’. If no ‘{OWNER}’ is given, it will be assumed to be owned by the SDSS organization.
astra.utils.github.validate_repository_name(repository_name)

Validate a given GitHub repository name.

Parameters:repository_name – The given repository name.
astra.utils.github.get_authentication_token(token=None)

Check the Astra configuration and the SDSS_GITHUB_KEY environment variables (in that order) for a GitHub personal access token.

Parameters:token – [optional] If given, then this token will be used instead of whatever is stored elsewhere.
Returns:The first authentication token that was found.
Raises:ValueError – If no token is given, and no token is found.
astra.utils.github.graphql(query_string, token=None)

Execute a GraphQL query on GitHub.

Parameters:
  • query_string – The query string to execute.
  • token – [optional] The GitHub personal access token to use for this query. If None is given then this will default to the access token called “github.token” in astra.config.
astra.utils.github.get_repository_summary(owner, repository, **kwargs)

Return summary information about a GitHub repository using the GitHub GraphQL API.

Parameters:
  • owner – The GitHub username of the owner.
  • repository – The name of the repository.
Returns:

The metadata dictionary for the requested repository, as given by GitHub.

astra.utils.github.get_most_recent_release(owner, repository, n=1, **kwargs)

Query the GitHub GraphQL API to access information about the most recent release for the given owner and repository.

Parameters:
  • owner – The GitHub username of the owner.
  • repository – The name of the repository.