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>}
.
Field | Field ID | Type | Note |
---|
Token (required) | token | string | Fill 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.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_LIST_PULL_REQUESTS |
Owner (required) | owner | string | Owner of the repository. |
Repository (required) | repository | string | Repository name. |
State | state | string | State of the PRs, including open, closed, all. Default is open. |
Sort | sort | string | Sort the PRs by created, updated, popularity, or long-running. Default is created. |
Direction | direction | string | Direction of the sort, including asc or desc. Default is desc. |
Page | page | integer | Page number of the results to fetch. Default is 1. |
Per Page | per-page | integer | Number of results to fetch per page. Default is 30. |
Output | ID | Type | Description |
---|
Pull Requests | pull-requests | array[object] | An array of PRs. |
Output Objects in List Pull Requests
Pull Requests
Field | Field ID | Type | Note |
---|
PR base | base | string | Base commit of the PR (in SHA value). |
PR body | body | string | Body of the PR. |
Number of PR comments | comments-num | integer | Number of comments on the PR. |
Commits | commits | array | Commits in the PR. |
Number of PR commits | commits-num | integer | Number of commits in the PR. |
PR diff url | diff-url | string | URL to the diff of the PR. |
PR head | head | string | Head commit of the PR (in SHA value). |
PR id | id | integer | ID of the PR. |
PR number | number | integer | Number of the PR. |
Number of PR review comments | review-comments-num | integer | Number of review comments in the PR. |
PR state | state | string | State of the PR. |
PR Title | title | string | Title of the PR. |
Commits
Field | Field ID | Type | Note |
---|
Files | files | array | Files in the commit. |
Commit message | message | string | Message of the commit. |
Commit SHA | sha | string | SHA of the commit. |
Commit stats | stats | object | Stats of changes. |
Commit Stats
Field | Field ID | Type | Note |
---|
Additions | additions | integer | Number of additions in the commit. |
Total changes | changes | integer | Total number of changes in the commit. |
Deletions | deletions | integer | Number of deletions in the commit. |
Files
Field | Field ID | Type | Note |
---|
Additions | additions | integer | Number of additions in the commit. |
Total changes | changes | integer | Total number of changes in the commit. |
Deletions | deletions | integer | Number of deletions in the commit. |
File name | filename | string | Name of the file. |
Patch | patch | string | Patch 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.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_GET_PULL_REQUEST |
Owner (required) | owner | string | Owner of the repository. |
Repository (required) | repository | string | Repository name. |
PR Number | pr-number | integer | Number of the PR. 0 for the latest PR. |
Output | ID | Type | Description |
---|
PR ID (optional) | id | integer | ID of the PR. |
PR Number (optional) | number | integer | Number of the PR. |
PR State (optional) | state | string | State of the PR. |
PR Title (optional) | title | string | Title of the PR. |
PR Body (optional) | body | string | Body of the PR. |
PR Diff URL (optional) | diff-url | string | URL to the diff of the PR. |
PR Head (optional) | head | string | Head commit of the PR (in SHA value). |
PR Base (optional) | base | string | Base commit of the PR (in SHA value). |
Number of PR Comments (optional) | comments-num | integer | Number of comments on the PR. |
Number of PR Commits (optional) | commits-num | integer | Number of commits in the PR. |
Number of PR Review Comments (optional) | review-comments-num | integer | Number of review comments in the PR. |
Commits (optional) | commits | array[object] | Commits in the PR. |
Output Objects in Get Pull Request
Commits
Field | Field ID | Type | Note |
---|
Files | files | array | Files in the commit. |
Commit message | message | string | Message of the commit. |
Commit SHA | sha | string | SHA of the commit. |
Commit stats | stats | object | Stats of changes. |
Commit Stats
Field | Field ID | Type | Note |
---|
Additions | additions | integer | Number of additions in the commit. |
Total changes | changes | integer | Total number of changes in the commit. |
Deletions | deletions | integer | Number of deletions in the commit. |
Files
Field | Field ID | Type | Note |
---|
Additions | additions | integer | Number of additions in the commit. |
Total changes | changes | integer | Total number of changes in the commit. |
Deletions | deletions | integer | Number of deletions in the commit. |
File name | filename | string | Name of the file. |
Patch | patch | string | Patch of the file. |
#Get Commit
Get a commit from a repository, given the commit SHA
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_GET_COMMIT |
Owner (required) | owner | string | Owner of the repository. |
Repository (required) | repository | string | Repository name. |
Commit SHA (required) | sha | string | SHA of the commit. |
Output | ID | Type | Description |
---|
Commit SHA (optional) | sha | string | SHA of the commit. |
Commit Message (optional) | message | string | Message of the commit. |
Commit Stats (optional) | stats | object | Stats of changes. |
Files (optional) | files | array[object] | Files in the commit. |
Output Objects in Get Commit
Commit Stats
Field | Field ID | Type | Note |
---|
Additions | additions | integer | Number of additions in the commit. |
Total changes | changes | integer | Total number of changes in the commit. |
Deletions | deletions | integer | Number of deletions in the commit. |
Files
Field | Field ID | Type | Note |
---|
Additions | additions | integer | Number of additions in the commit. |
Total changes | changes | integer | Total number of changes in the commit. |
Deletions | deletions | integer | Number of deletions in the commit. |
File name | filename | string | Name of the file. |
Patch | patch | string | Patch of the file. |
Get the review comments in a pull request. The comments can be on a specific line or on the PR as a whole.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_LIST_REVIEW_COMMENTS |
Owner (required) | owner | string | Owner of the repository. |
Repository (required) | repository | string | Repository name. |
PR Number | pr-number | integer | Number of the PR. Default is 0 , which retrieves all comments on all PRs in the repository. |
Sort | sort | string | Sort the comments by created, updated. Default is created. |
Direction | direction | string | Direction of the sort, including asc or desc. Default is desc. |
Since | since | string | Only comments updated at or after this time are returned. Default is 2021-01-01T00:00:00Z. |
Page | page | integer | Page number of the results to fetch. Default is 1. |
Per Page | per-page | integer | Number of results to fetch per page. Default is 30. |
Output | ID | Type | Description |
---|
Comments | comments | array[object] | An array of comments. |
Output Objects in List Review Comments
Field | Field ID | Type | Note |
---|
Comment body | body | string | Body of the comment. |
Commit SHA | commitId | string | SHA of the commit on which you want to comment. |
Comment created at | created-at | string | Time the comment was created. |
Comment id | id | integer | ID of the comment. |
In Reply To | in-reply-to-id | integer | ID of the comment this comment is in reply to. |
Comment end line | line | integer | The 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 path | path | string | Path of the file the comment is on. |
Comment end side | side | string | Side 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 line | start-line | integer | The 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 side | start-side | string | Side 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 | subject-type | string | Subject type of the comment, can be one of: line, file. Default is line. |
Comment updated at | updated-at | string | Time the comment was updated. |
User | user | object | User who created the comment. |
Field | Field ID | Type | Note |
---|
User id | id | integer | ID of the user. |
User URL | url | string | URL of the user. |
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.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_CREATE_REVIEW_COMMENT |
Owner (required) | owner | string | Owner of the repository. |
Repository (required) | repository | string | Repository name. |
PR Number (required) | pr-number | integer | Number of the PR. |
Comment (required) | comment | object | The comment to be added. |
Input Objects in Create Review Comment
The comment to be added.
Field | Field ID | Type | Note |
---|
Comment body | body | string | Body of the comment. |
Commit SHA | commit-id | string | SHA of the commit on which you want to comment. |
Comment end line | line | integer | The 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 path | path | string | Path of the file the comment is on. |
Comment end side | side | string | Side 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 |
Comment start line | start-line | integer | The 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 side | start-side | string | Side 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 |
Comment type | subject-type | string | Subject type of the comment, can be one of: line, file. Default is line.
Enum values |
Output | ID | Type | Description |
---|
Comment ID (optional) | id | integer | ID of the comment. |
In Reply To (optional) | in-reply-to-id | integer | ID of the comment this comment is in reply to. |
Commit SHA (optional) | commitId | string | SHA of the commit on which you want to comment. |
Comment Body (optional) | body | string | Body of the comment. |
Comment Path (optional) | path | string | Path of the file the comment is on. |
Comment End Line (optional) | line | integer | The 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-line | integer | The 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) | side | string | Side 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-side | string | Side 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-type | string | Subject type of the comment, can be one of: line, file. Default is line. |
Comment Created At (optional) | created-at | string | Time the comment was created. |
Comment Updated At (optional) | updated-at | string | Time the comment was updated. |
User (optional) | user | object | User who created the comment. |
Output Objects in Create Review Comment
Field | Field ID | Type | Note |
---|
User id | id | integer | ID of the user. |
User URL | url | string | URL 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.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_LIST_ISSUES |
Owner (required) | owner | string | Owner of the repository. |
Repository (required) | repository | string | Repository name. |
State | state | string | State of the issues, can be one of: open, closed, all. Default is open. |
Sort | sort | string | Sort the issues by created, updated, popularity, or long-running. Default is created. |
Direction | direction | string | Direction of the sort, can be one of: asc, desc. Default is desc. |
Since | since | string | Only issues updated at or after this time are returned. Default is 2021-01-01T00:00:00Z. |
No Pull Request | no-pull-request | boolean | Whether 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. |
Page | page | integer | Page number of the results to fetch. Default is 1. |
Per Page | per-page | integer | Number of results to fetch per page. Default is 30. |
Output | ID | Type | Description |
---|
Issues | issues | array[object] | An array of issues. |
Output Objects in List Issues
Issues
Field | Field ID | Type | Note |
---|
Assignee | assignee | string | Assignee of the issue. |
Assignees | assignees | array | Assignees of the issue. |
Issue body | body | string | Body of the issue. |
Is Pull Request | is-pull-request | boolean | Whether the issue is a pull request. |
Labels | labels | array | Labels of the issue. |
Issue Number | number | integer | Number of the issue. |
Issue state | state | string | State of the issue. |
Issue title | title | string | Title 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.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_GET_ISSUE |
Owner (required) | owner | string | Owner of the repository. |
Repository (required) | repository | string | Repository name. |
Issue Number (required) | issue-number | integer | Number of the issue. |
Output | ID | Type | Description |
---|
Issue Number (optional) | number | integer | Number of the issue. |
Issue State (optional) | state | string | State of the issue. |
Issue Title (optional) | title | string | Title of the issue. |
Issue Body (optional) | body | string | Body of the issue. |
Assignee (optional) | assignee | string | Assignee of the issue. |
Assignees (optional) | assignees | array[string] | Assignees of the issue. |
Labels (optional) | labels | array[string] | Labels of the issue. |
Is Pull Request (optional) | is-pull-request | boolean | Whether the issue is a pull request. |
#Create Issue
Create an issue.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_CREATE_ISSUE |
Owner (required) | owner | string | Owner of the repository. |
Repository (required) | repository | string | Repository name. |
Issue Title (required) | title | string | Title of the issue. |
Issue Body (required) | body | string | Body of the issue. |
Assignees | assignees | array[string] | Assignees of the issue. |
Labels | labels | array[string] | Labels of the issue. |
Output | ID | Type | Description |
---|
Issue Number (optional) | number | integer | Number of the issue. |
Issue State (optional) | state | string | State of the issue. |
Issue Title (optional) | title | string | Title of the issue. |
Issue Body (optional) | body | string | Body of the issue. |
Assignee (optional) | assignee | string | Assignee of the issue. |
Assignees (optional) | assignees | array[string] | Assignees of the issue. |
Labels (optional) | labels | array[string] | Labels of the issue. |
Is Pull Request (optional) | is-pull-request | boolean | Whether the issue is a pull request. |
#Create Webhook
Create a webhook for a repository.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_CREATE_WEBHOOK |
Owner (required) | owner | string | Owner of the repository. |
Repository (required) | repository | string | Repository name. |
Webhook URL (required) | hook-url | string | URL to send the payload to. |
Events (required) | events | array[string] | Events to trigger the webhook. Please see the github document for more information. |
Active | active | boolean | Whether the webhook is active. Default is false. |
Content Type | content-type | string | Content type of the webhook, can be one of: json, form. Default is json. |
Hook Secret | hook-secret | string | If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers. (see the document). |
Output | ID | Type | Description |
---|
Webhook ID (optional) | id | integer | ID of the webhook. |
Webhook URL (optional) | url | string | URL of the webhook. |
Ping URL (optional) | ping-url | string | URL to ping the webhook. |
Test URL (optional) | test-url | string | URL to test the webhook. |
Config (optional) | config | object | Configuration of the webhook. |
Output Objects in Create Webhook
Config
Field | Field ID | Type | Note |
---|
Content Type | content-type | string | Content type of the webhook. |
Insecure SSL | insecure-ssl | string | Whether the webhook is insecure. |
Webhook URL | url | string | URL of the webhook. |
#Example Recipes
Recipe for the List GitHub Repo Issues pipeline.
task: TASK_TEXT_GENERATION_CHAT
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.
owner: ${variable.repository-owner}
repository: ${variable.repository-name}
since: "2021-01-01T00:00:00Z"
token: ${secret.github-demo}
description: Name of the repository i.e. instill-core
description: Name of the repository owner i.e. instill-ai
value: ${anthropic-0.output.text}