GitHub

The GitHub component is an application component that allows users to do anything available on GitHub. It can carry out the following tasks:

#Release Stage

Alpha

#Configuration

The component definition and tasks are defined in the definition.json and tasks.json files respectively.

#Setup

In order to communicate with GitHub, the following connection details need to be provided. You may specify them directly in a pipeline recipe as key-value pairs within the component's setup block, or you can create a Connection from the Integration Settings page and reference the whole setup as setup: ${connection.<my-connection-id>}.

FieldField IDTypeNote
Token (required)tokenstringFill in your GitHub access token for advanced usages. For more information about how to create tokens, please refer to the github settings.

#Supported Tasks

#List Pull Requests

Get the list of all pull requests in a repository. Detailed information about each commit in a PR is omitted, please use the Get Commit task or the Get Pull Request task to get the details of a commit.

InputIDTypeDescription
Task ID (required)taskstringTASK_LIST_PULL_REQUESTS
Owner (required)ownerstringOwner of the repository.
Repository (required)repositorystringRepository name.
StatestatestringState of the PRs, including open, closed, all. Default is open.
SortsortstringSort the PRs by created, updated, popularity, or long-running. Default is created.
DirectiondirectionstringDirection of the sort, including asc or desc. Default is desc.
PagepageintegerPage number of the results to fetch. Default is 1.
Per Pageper-pageintegerNumber of results to fetch per page. Default is 30.
OutputIDTypeDescription
Pull Requestspull-requestsarray[object]An array of PRs.
Output Objects in List Pull Requests

Pull Requests

FieldField IDTypeNote
PR basebasestringBase commit of the PR (in SHA value).
PR bodybodystringBody of the PR.
Number of PR commentscomments-numintegerNumber of comments on the PR.
CommitscommitsarrayCommits in the PR.
Number of PR commitscommits-numintegerNumber of commits in the PR.
PR diff urldiff-urlstringURL to the diff of the PR.
PR headheadstringHead commit of the PR (in SHA value).
PR ididintegerID of the PR.
PR numbernumberintegerNumber of the PR.
Number of PR review commentsreview-comments-numintegerNumber of review comments in the PR.
PR statestatestringState of the PR.
PR TitletitlestringTitle of the PR.

Commits

FieldField IDTypeNote
FilesfilesarrayFiles in the commit.
Commit messagemessagestringMessage of the commit.
Commit SHAshastringSHA of the commit.
Commit statsstatsobjectStats of changes.

Commit Stats

FieldField IDTypeNote
AdditionsadditionsintegerNumber of additions in the commit.
Total changeschangesintegerTotal number of changes in the commit.
DeletionsdeletionsintegerNumber of deletions in the commit.

Files

FieldField IDTypeNote
AdditionsadditionsintegerNumber of additions in the commit.
Total changeschangesintegerTotal number of changes in the commit.
DeletionsdeletionsintegerNumber of deletions in the commit.
File namefilenamestringName of the file.
PatchpatchstringPatch of the file.

#Get Pull Request

Get a pull request from a repository, given the PR number. This will default to the latest PR if no PR number is provided.

InputIDTypeDescription
Task ID (required)taskstringTASK_GET_PULL_REQUEST
Owner (required)ownerstringOwner of the repository.
Repository (required)repositorystringRepository name.
PR Numberpr-numberintegerNumber of the PR. 0 for the latest PR.
OutputIDTypeDescription
PR ID (optional)idintegerID of the PR.
PR Number (optional)numberintegerNumber of the PR.
PR State (optional)statestringState of the PR.
PR Title (optional)titlestringTitle of the PR.
PR Body (optional)bodystringBody of the PR.
PR Diff URL (optional)diff-urlstringURL to the diff of the PR.
PR Head (optional)headstringHead commit of the PR (in SHA value).
PR Base (optional)basestringBase commit of the PR (in SHA value).
Number of PR Comments (optional)comments-numintegerNumber of comments on the PR.
Number of PR Commits (optional)commits-numintegerNumber of commits in the PR.
Number of PR Review Comments (optional)review-comments-numintegerNumber of review comments in the PR.
Commits (optional)commitsarray[object]Commits in the PR.
Output Objects in Get Pull Request

Commits

FieldField IDTypeNote
FilesfilesarrayFiles in the commit.
Commit messagemessagestringMessage of the commit.
Commit SHAshastringSHA of the commit.
Commit statsstatsobjectStats of changes.

Commit Stats

FieldField IDTypeNote
AdditionsadditionsintegerNumber of additions in the commit.
Total changeschangesintegerTotal number of changes in the commit.
DeletionsdeletionsintegerNumber of deletions in the commit.

Files

FieldField IDTypeNote
AdditionsadditionsintegerNumber of additions in the commit.
Total changeschangesintegerTotal number of changes in the commit.
DeletionsdeletionsintegerNumber of deletions in the commit.
File namefilenamestringName of the file.
PatchpatchstringPatch of the file.

#Get Commit

Get a commit from a repository, given the commit SHA

InputIDTypeDescription
Task ID (required)taskstringTASK_GET_COMMIT
Owner (required)ownerstringOwner of the repository.
Repository (required)repositorystringRepository name.
Commit SHA (required)shastringSHA of the commit.
OutputIDTypeDescription
Commit SHA (optional)shastringSHA of the commit.
Commit Message (optional)messagestringMessage of the commit.
Commit Stats (optional)statsobjectStats of changes.
Files (optional)filesarray[object]Files in the commit.
Output Objects in Get Commit

Commit Stats

FieldField IDTypeNote
AdditionsadditionsintegerNumber of additions in the commit.
Total changeschangesintegerTotal number of changes in the commit.
DeletionsdeletionsintegerNumber of deletions in the commit.

Files

FieldField IDTypeNote
AdditionsadditionsintegerNumber of additions in the commit.
Total changeschangesintegerTotal number of changes in the commit.
DeletionsdeletionsintegerNumber of deletions in the commit.
File namefilenamestringName of the file.
PatchpatchstringPatch of the file.

#List Review Comments

Get the review comments in a pull request. The comments can be on a specific line or on the PR as a whole.

InputIDTypeDescription
Task ID (required)taskstringTASK_LIST_REVIEW_COMMENTS
Owner (required)ownerstringOwner of the repository.
Repository (required)repositorystringRepository name.
PR Numberpr-numberintegerNumber of the PR. Default is 0, which retrieves all comments on all PRs in the repository.
SortsortstringSort the comments by created, updated. Default is created.
DirectiondirectionstringDirection of the sort, including asc or desc. Default is desc.
SincesincestringOnly comments updated at or after this time are returned. Default is 2021-01-01T00:00:00Z.
PagepageintegerPage number of the results to fetch. Default is 1.
Per Pageper-pageintegerNumber of results to fetch per page. Default is 30.
OutputIDTypeDescription
Commentscommentsarray[object]An array of comments.
Output Objects in List Review Comments

Comments

FieldField IDTypeNote
Comment bodybodystringBody of the comment.
Commit SHAcommitIdstringSHA of the commit on which you want to comment.
Comment created atcreated-atstringTime the comment was created.
Comment ididintegerID of the comment.
In Reply Toin-reply-to-idintegerID of the comment this comment is in reply to.
Comment end linelineintegerThe line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to.
Comment pathpathstringPath of the file the comment is on.
Comment end sidesidestringSide of the end line, can be one of: LEFT, RIGHT, side. LEFT is the left side of the diff (deletion), RIGHT is the right side of the diff (addition), and side is the comment on the PR as a whole. Default is side.
Comment start linestart-lineintegerThe first line in the pull request diff that your multi-line comment applies to. Only multi-line comment needs to fill this field.
Comment start sidestart-sidestringSide of the start line, can be one of: LEFT, RIGHT, side. LEFT is the left side of the diff (deletion), RIGHT is the right side of the diff (addition), and side is the comment on the PR as a whole. Default is side.
Comment typesubject-typestringSubject type of the comment, can be one of: line, file. Default is line.
Comment updated atupdated-atstringTime the comment was updated.
UseruserobjectUser who created the comment.

User

FieldField IDTypeNote
User ididintegerID of the user.
User URLurlstringURL of the user.

#Create Review Comment

Create a review comment in a pull request. The comment can be a general comment or a review comment. The comment can be on a specific line or on the PR as a whole.

InputIDTypeDescription
Task ID (required)taskstringTASK_CREATE_REVIEW_COMMENT
Owner (required)ownerstringOwner of the repository.
Repository (required)repositorystringRepository name.
PR Number (required)pr-numberintegerNumber of the PR.
Comment (required)commentobjectThe comment to be added.
Input Objects in Create Review Comment

Comment

The comment to be added.

FieldField IDTypeNote
Comment bodybodystringBody of the comment.
Commit SHAcommit-idstringSHA of the commit on which you want to comment.
Comment end linelineintegerThe line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to.
Comment pathpathstringPath of the file the comment is on.
Comment end sidesidestringSide of the end line, can be one of: LEFT, RIGHT, side. LEFT is the left side of the diff (deletion), RIGHT is the right side of the diff (addition), and side is the comment on the PR as a whole. Default is side.
Enum values
  • LEFT
  • RIGHT
  • side
Comment start linestart-lineintegerThe first line in the pull request diff that your multi-line comment applies to. Only multi-line comment needs to fill this field.
Comment start sidestart-sidestringSide of the start line, can be one of: LEFT, RIGHT, side. LEFT is the left side of the diff (deletion), RIGHT is the right side of the diff (addition), and side is the comment on the PR as a whole. Default is side.
Enum values
  • LEFT
  • RIGHT
  • side
Comment typesubject-typestringSubject type of the comment, can be one of: line, file. Default is line.
Enum values
  • line
  • file
OutputIDTypeDescription
Comment ID (optional)idintegerID of the comment.
In Reply To (optional)in-reply-to-idintegerID of the comment this comment is in reply to.
Commit SHA (optional)commitIdstringSHA of the commit on which you want to comment.
Comment Body (optional)bodystringBody of the comment.
Comment Path (optional)pathstringPath of the file the comment is on.
Comment End Line (optional)lineintegerThe line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to.
Comment Start Line (optional)start-lineintegerThe first line in the pull request diff that your multi-line comment applies to. Only multi-line comment needs to fill this field.
Comment End Side (optional)sidestringSide of the end line, can be one of: LEFT, RIGHT, side. LEFT is the left side of the diff (deletion), RIGHT is the right side of the diff (addition), and side is the comment on the PR as a whole. Default is side.
Comment Start Side (optional)start-sidestringSide of the start line, can be one of: LEFT, RIGHT, side. LEFT is the left side of the diff (deletion), RIGHT is the right side of the diff (addition), and side is the comment on the PR as a whole. Default is side.
Comment Type (optional)subject-typestringSubject type of the comment, can be one of: line, file. Default is line.
Comment Created At (optional)created-atstringTime the comment was created.
Comment Updated At (optional)updated-atstringTime the comment was updated.
User (optional)userobjectUser who created the comment.
Output Objects in Create Review Comment

User

FieldField IDTypeNote
User ididintegerID of the user.
User URLurlstringURL of the user.

#List Issues

Get the list of all issues in a repository,This can be a pull request or a general issue, and you can tell by the is-pull-request field.

InputIDTypeDescription
Task ID (required)taskstringTASK_LIST_ISSUES
Owner (required)ownerstringOwner of the repository.
Repository (required)repositorystringRepository name.
StatestatestringState of the issues, can be one of: open, closed, all. Default is open.
SortsortstringSort the issues by created, updated, popularity, or long-running. Default is created.
DirectiondirectionstringDirection of the sort, can be one of: asc, desc. Default is desc.
SincesincestringOnly issues updated at or after this time are returned. Default is 2021-01-01T00:00:00Z.
No Pull Requestno-pull-requestbooleanWhether to not include pull requests in the response. Since issue and pr use the same indexing system in GitHub, the API returns all relevant objects (issues and pr). Default is false.
PagepageintegerPage number of the results to fetch. Default is 1.
Per Pageper-pageintegerNumber of results to fetch per page. Default is 30.
OutputIDTypeDescription
Issuesissuesarray[object]An array of issues.
Output Objects in List Issues

Issues

FieldField IDTypeNote
AssigneeassigneestringAssignee of the issue.
AssigneesassigneesarrayAssignees of the issue.
Issue bodybodystringBody of the issue.
Is Pull Requestis-pull-requestbooleanWhether the issue is a pull request.
LabelslabelsarrayLabels of the issue.
Issue NumbernumberintegerNumber of the issue.
Issue statestatestringState of the issue.
Issue titletitlestringTitle of the issue.

#Get Issue

Get an issue. This can be a pull request or a general issue, and you can tell by the is-pull-request field.

InputIDTypeDescription
Task ID (required)taskstringTASK_GET_ISSUE
Owner (required)ownerstringOwner of the repository.
Repository (required)repositorystringRepository name.
Issue Number (required)issue-numberintegerNumber of the issue.
OutputIDTypeDescription
Issue Number (optional)numberintegerNumber of the issue.
Issue State (optional)statestringState of the issue.
Issue Title (optional)titlestringTitle of the issue.
Issue Body (optional)bodystringBody of the issue.
Assignee (optional)assigneestringAssignee of the issue.
Assignees (optional)assigneesarray[string]Assignees of the issue.
Labels (optional)labelsarray[string]Labels of the issue.
Is Pull Request (optional)is-pull-requestbooleanWhether the issue is a pull request.

#Create Issue

Create an issue.

InputIDTypeDescription
Task ID (required)taskstringTASK_CREATE_ISSUE
Owner (required)ownerstringOwner of the repository.
Repository (required)repositorystringRepository name.
Issue Title (required)titlestringTitle of the issue.
Issue Body (required)bodystringBody of the issue.
Assigneesassigneesarray[string]Assignees of the issue.
Labelslabelsarray[string]Labels of the issue.
OutputIDTypeDescription
Issue Number (optional)numberintegerNumber of the issue.
Issue State (optional)statestringState of the issue.
Issue Title (optional)titlestringTitle of the issue.
Issue Body (optional)bodystringBody of the issue.
Assignee (optional)assigneestringAssignee of the issue.
Assignees (optional)assigneesarray[string]Assignees of the issue.
Labels (optional)labelsarray[string]Labels of the issue.
Is Pull Request (optional)is-pull-requestbooleanWhether the issue is a pull request.

#Create Webhook

Create a webhook for a repository.

InputIDTypeDescription
Task ID (required)taskstringTASK_CREATE_WEBHOOK
Owner (required)ownerstringOwner of the repository.
Repository (required)repositorystringRepository name.
Webhook URL (required)hook-urlstringURL to send the payload to.
Events (required)eventsarray[string]Events to trigger the webhook. Please see the github document for more information.
ActiveactivebooleanWhether the webhook is active. Default is false.
Content Typecontent-typestringContent type of the webhook, can be one of: json, form. Default is json.
Hook Secrethook-secretstringIf provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers. (see the document).
OutputIDTypeDescription
Webhook ID (optional)idintegerID of the webhook.
Webhook URL (optional)urlstringURL of the webhook.
Ping URL (optional)ping-urlstringURL to ping the webhook.
Test URL (optional)test-urlstringURL to test the webhook.
Config (optional)configobjectConfiguration of the webhook.
Output Objects in Create Webhook

Config

FieldField IDTypeNote
Content Typecontent-typestringContent type of the webhook.
Insecure SSLinsecure-sslstringWhether the webhook is insecure.
Webhook URLurlstringURL of the webhook.

#Example Recipes

Recipe for the List GitHub Repo Issues pipeline.


version: v1beta
component:
anthropic-0:
type: anthropic
task: TASK_TEXT_GENERATION_CHAT
input:
max-new-tokens: 1000
model-name: claude-3-5-sonnet-latest
prompt: Summarise and pick the most important issues from this list ${github.output.issues}
system-message: You are a helpful assistant.
temperature: 0.7
top-k: 10
github:
type: github
task: TASK_LIST_ISSUES
input:
direction: desc
no-pull-request: false
owner: ${variable.repository-owner}
page: 1
per-page: 30
repository: ${variable.repository-name}
since: "2021-01-01T00:00:00Z"
sort: created
state: open
setup:
token: ${secret.github-demo}
variable:
repository-name:
title: Repository Name
description: Name of the repository i.e. instill-core
format: string
repository-owner:
title: Repository Owner
description: Name of the repository owner i.e. instill-ai
format: string
output:
result:
title: Result
value: ${anthropic-0.output.text}