# GitHub Tasks


A collection of tasks for interacting with GitHub.

# CreateGitHubPR

class

prefect.tasks.github.prs.CreateGitHubPR

(repo=None, title=None, body=None, head=None, base=None, **kwargs)[source]

Task for opening/creating new GitHub Pull Requests using the v3 version of the GitHub REST API.

Args:

  • repo (str, optional): the name of the repository to open the issue in; must be provided in the form organization/repo_name; can also be provided to the run method
  • title (str, optional): the title of the issue to create; can also be provided to the run method
  • body (str, optional): the contents of the issue; can also be provided to the run method
  • head (str, optional): the name of the branch where your changes are implemented; can also be provided to the run method
  • base (str, optional): the name of the branch you want the changes pulled into; can also be provided to the run method
  • **kwargs (Any, optional): additional keyword arguments to pass to the standard Task init method

methods:                                                                                                                                                       

prefect.tasks.github.prs.CreateGitHubPR.run

(repo=None, title=None, body=None, head=None, base=None, token=None)[source]

Run method for this Task. Invoked by calling this Task after initialization within a Flow context, or by using Task.bind.

Args:

  • repo (str, optional): the name of the repository to open the issue in; must be provided in the form organization/repo_name; defaults to the one provided at initialization
  • title (str, optional): the title of the issue to create; defaults to the one provided at initialization
  • body (str, optional): the contents of the issue; defaults to the one provided at initialization
  • head (str, optional): the name of the branch where your changes are implemented; defaults to the one provided at initialization
  • base (str, optional): the name of the branch you want the changes pulled into; defaults to the one provided at initialization
  • token (str): a GitHub API token
Raises:
  • ValueError: if a repo was never provided
  • HTTPError: if the POST request returns a non-200 status code
Returns:
  • None



# OpenGitHubIssue

class

prefect.tasks.github.issues.OpenGitHubIssue

(repo=None, title=None, body=None, labels=None, **kwargs)[source]

Task for opening / creating new GitHub issues using the v3 version of the GitHub REST API.

Args:

  • repo (str, optional): the name of the repository to open the issue in; must be provided in the form organization/repo_name; can also be provided to the run method
  • title (str, optional): the title of the issue to create; can also be provided to the run method
  • body (str, optional): the contents of the issue; can also be provided to the run method
  • labels (List[str], optional): a list of labels to apply to the newly opened issues; can also be provided to the run method
  • **kwargs (Any, optional): additional keyword arguments to pass to the standard Task init method

methods:                                                                                                                                                       

prefect.tasks.github.issues.OpenGitHubIssue.run

(repo=None, title=None, body=None, labels=None, token=None)[source]

Run method for this Task. Invoked by calling this Task after initialization within a Flow context, or by using Task.bind.

Args:

  • repo (str, optional): the name of the repository to open the issue in; must be provided in the form organization/repo_name; defaults to the one provided at initialization
  • title (str, optional): the title of the issue to create; defaults to the one provided at initialization
  • body (str, optional): the contents of the issue; defaults to the one provided at initialization
  • labels (List[str], optional): a list of labels to apply to the newly opened issues; defaults to the ones provided at initialization
  • token (str): a GitHub API token
Raises:
  • ValueError: if a repo was never provided
  • HTTPError: if the POST request returns a non-200 status code
Returns:
  • None



# CreateIssueComment

class

prefect.tasks.github.comments.CreateIssueComment

(repo=None, issue_number=None, body=None, **kwargs)[source]

Task for creating a comment on the specified GitHub issue using the v3 version of the GitHub REST API.

Args:

  • repo (str, optional): the name of the repository to create the comment in; must be provided in the form organization/repo_name; can also be provided to the run method
  • issue_number (int, optional): the ID of the issue to create the comment on.
  • body (str, optional): the body of the comment; can also be provided to the run method
  • **kwargs (Any, optional): additional keyword arguments to pass to the standard Task init method
References:

methods:                                                                                                                                                       

prefect.tasks.github.comments.CreateIssueComment.run

(repo=None, issue_number=None, body=None, token=None)[source]

Run method for this Task. Invoked by calling this Task after initialization within a Flow context, or by using Task.bind.

Args:

  • repo (str, optional): the name of the repository to create the comment in; must be provided in the form organization/repo_name; can also be provided to the run method
  • issue_number (int, optional): the ID of the issue to create the comment on.
  • body (str, optional): the body of the comment; can also be provided to the run method
  • token (str): a GitHub API token
Raises:
  • ValueError: if a repo or an issue_number was never provided
  • HTTPError: if the POST request returns a non-200 status code
Returns:
  • None



# GetRepoInfo

class

prefect.tasks.github.repos.GetRepoInfo

(repo=None, info_keys=None, **kwargs)[source]

Task for retrieving GitHub repository information using the v3 version of the GitHub REST API.

Args:

  • repo (str, optional): the name of the repository to open the issue in; must be provided in the form organization/repo_name or user/repo_name; can also be provided to the run method
  • info_keys (List[str], optional): a list of repo attributes to pull (e.g., ["stargazers_count", "subscribers_count"]). A full list of available keys can be found in the official GitHub documentation
  • **kwargs (Any, optional): additional keyword arguments to pass to the standard Task init method

methods:                                                                                                                                                       

prefect.tasks.github.repos.GetRepoInfo.run

(repo=None, info_keys=None, token=None)[source]

Run method for this Task. Invoked by calling this Task after initialization within a Flow context, or by using Task.bind.

Args:

  • repo (str, optional): the name of the repository to open the issue in; must be provided in the form organization/repo_name; defaults to the one provided at initialization
  • info_keys (List[str], optional): a list of repo attributes to pull (e.g., ["stargazers_count", "subscribers_count"]). A full list of available keys can be found in the official GitHub documentation
  • token (str): a GitHub access token
Raises:
  • ValueError: if a repo was never provided
  • HTTPError: if the GET request returns a non-200 status code
Returns:
  • dict: dictionary of the requested information



# CreateBranch

class

prefect.tasks.github.repos.CreateBranch

(repo=None, base="master", branch_name=None, **kwargs)[source]

Task for creating new branches using the v3 version of the GitHub REST API.

Args:

  • repo (str, optional): the name of the repository to create the branch in; must be provided in the form organization/repo_name or user/repo_name; can also be provided to the run method
  • base (str, optional): the name of the branch you want to branch off; can also be provided to the run method. Defaults to "master".
  • branch_name (str, optional): the name of the new branch; can also be provided to the run method
  • **kwargs (Any, optional): additional keyword arguments to pass to the standard Task init method

methods:                                                                                                                                                       

prefect.tasks.github.repos.CreateBranch.run

(repo=None, base=None, branch_name=None, token=None)[source]

Run method for this Task. Invoked by calling this Task after initialization within a Flow context, or by using Task.bind.

Args:

  • repo (str, optional): the name of the repository to open the issue in; must be provided in the form organization/repo_name; defaults to the one provided at initialization
  • base (str, optional): the name of the branch you want to branch off; if not provided here, defaults to the one set at initialization
  • branch_name (str, optional): the name of the new branch; if not provided here, defaults to the one set at initialization
  • token (str): a GitHub access token
Raises:
  • ValueError: if a repo or branch_name was never provided, or if the base branch wasn't found
  • HTTPError: if the GET request returns a non-200 status code
Returns:
  • dict: dictionary of the response (includes commit hash, etc.)



This documentation was auto-generated from commit bd9182e
on July 31, 2024 at 18:02 UTC