github_tools package

Tools for GitHub interaction.

class github_tools.GHPRSession(token, domain, repo, pull_id)[source]

Bases: requests.sessions.Session

A GitHub session for managing a Pull Request.

base_url = None
post_comment(comment_body)[source]

Post Comment to PR.

request(method, url, *args, **kwargs)[source]

Place request.

github_tools.assign_pr(owner, repo, pr_number, users, token=None, keep_current=True)[source]

Assign PR to a user.

Parameters
  • owner (str) – name of user or org that owns the repo containing the PR

  • repo (str) – name of the repo containing the PR

  • users (iterable) – iterable of ssos for users to be assigned

  • token (Optional[str]) – token to authenticate to GitHub. If not provided, the GH_TOKEN environment variable will be checked.

  • keep_current (bool) – if True, leave current assignees in place, otherwise remove and assign only provided users.

github_tools.assign_pr_cli()[source]

Handle CLI calls to assign_pr.

Post a docs link back to a PR from within the PR Checker Jenkins job.

Parameters
  • token (str) – GitHub access token

  • doc_path (str) – the subpath from the job link where the docs can be found

Handle CLI calls for post_docs_link.