github

package
v0.29.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

---
title: "GitHub"
lang: "en-US"
draft: false
description: "Learn about how to set up a VDP GitHub component https://github.com/instill-ai/instill-core"
---

The GitHub component is an application component that allows users to do anything available on GitHub.
It can carry out the following tasks:
- [List Pull Requests](#list-pull-requests)
- [Get Pull Request](#get-pull-request)
- [Get Commit](#get-commit)
- [List Review Comments](#list-review-comments)
- [Create Review Comment](#create-review-comment)
- [List Issues](#list-issues)
- [Get Issue](#get-issue)
- [Create Issue](#create-issue)
- [Create Webhook](#create-webhook)

## Release Stage

`Alpha`

## Configuration

The component definition and tasks are defined in the [definition.json](https://github.com/instill-ai/component/blob/main/application/github/v0/config/definition.json) and [tasks.json](https://github.com/instill-ai/component/blob/main/application/github/v0/config/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**](https://www.instill.tech/docs/vdp/integration)
page and reference the whole `setup` as `setup:
${connection.<my-connection-id>}`.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 <a href="https://github.com/settings/tokens">github settings</a>.  |

</div>




## 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.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>






<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| [Pull Requests](#list-pull-requests-pull-requests) | `pull-requests` | array[object] | An array of PRs |
</div>

<details>
<summary> Output Objects in List Pull Requests</summary>

<h4 id="list-pull-requests-pull-requests">Pull Requests</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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](#list-pull-requests-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 |
</div>

<h4 id="list-pull-requests-commits">Commits</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| :--- | :--- | :--- | :--- |
| [Files](#list-pull-requests-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](#list-pull-requests-commit-stats) | `stats` | object | stats of changes |
</div>

<h4 id="list-pull-requests-commit-stats">Commit Stats</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>

<h4 id="list-pull-requests-files">Files</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>
</details>

### 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

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>






<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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](#get-pull-request-commits) (optional) | `commits` | array[object] | commits in the PR |
</div>

<details>
<summary> Output Objects in Get Pull Request</summary>

<h4 id="get-pull-request-commits">Commits</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| :--- | :--- | :--- | :--- |
| [Files](#get-pull-request-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](#get-pull-request-commit-stats) | `stats` | object | stats of changes |
</div>

<h4 id="get-pull-request-commit-stats">Commit Stats</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>

<h4 id="get-pull-request-files">Files</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>
</details>

### Get Commit

Get a commit from a repository, given the commit SHA

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>






<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Commit SHA (optional) | `sha` | string | SHA of the commit |
| Commit message (optional) | `message` | string | message of the commit |
| [Commit stats](#get-commit-commit-stats) (optional) | `stats` | object | stats of changes |
| [Files](#get-commit-files) (optional) | `files` | array[object] | files in the commit |
</div>

<details>
<summary> Output Objects in Get Commit</summary>

<h4 id="get-commit-commit-stats">Commit Stats</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>

<h4 id="get-commit-files">Files</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>
</details>

### 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.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>






<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| [Comments](#list-review-comments-comments) | `comments` | array[object] | An array of comments |
</div>

<details>
<summary> Output Objects in List Review Comments</summary>

<h4 id="list-review-comments-comments">Comments</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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](#list-review-comments-user) | `user` | object | User who created the comment |
</div>

<h4 id="list-review-comments-user">User</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| :--- | :--- | :--- | :--- |
| User id | `id` | integer | ID of the user |
| User URL | `url` | string | URL of the user |
</div>
</details>

### 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.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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](#create-review-comment-comment) (required) | `comment` | object | The comment to be added |
</div>


<details>
<summary> Input Objects in Create Review Comment</summary>

<h4 id="create-review-comment-comment">Comment</h4>

The comment to be added

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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.  <br/><details><summary><strong>Enum values</strong></summary><ul><li>`LEFT`</li><li>`RIGHT`</li><li>`side`</li></ul></details>  |
| 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.  <br/><details><summary><strong>Enum values</strong></summary><ul><li>`LEFT`</li><li>`RIGHT`</li><li>`side`</li></ul></details>  |
| Comment type | `subject-type` | string | Subject type of the comment, can be one of: line, file. Default is line  <br/><details><summary><strong>Enum values</strong></summary><ul><li>`line`</li><li>`file`</li></ul></details>  |
</div>
</details>



<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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](#create-review-comment-user) (optional) | `user` | object | User who created the comment |
</div>

<details>
<summary> Output Objects in Create Review Comment</summary>

<h4 id="create-review-comment-user">User</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Field | Field ID | Type | Note |
| :--- | :--- | :--- | :--- |
| User id | `id` | integer | ID of the user |
| User URL | `url` | string | URL of the user |
</div>
</details>

### 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.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>






<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| [Issues](#list-issues-issues) | `issues` | array[object] | An array of issues |
</div>

<details>
<summary> Output Objects in List Issues</summary>

<h4 id="list-issues-issues">Issues</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>
</details>

### 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.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>






<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>

### Create Issue

Create an issue

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>






<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>

### Create Webhook

Create a webhook for a repository

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 <a href="https://docs.github.com/en/webhooks/webhook-events-and-payloads">the github document</a> 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 <a href="https://docs.github.com/en/webhooks/webhook-events-and-payloads#delivery-headers">the document</a>) |
</div>






<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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](#create-webhook-config) (optional) | `config` | object | Configuration of the webhook |
</div>

<details>
<summary> Output Objects in Create Webhook</summary>

<h4 id="create-webhook-config">Config</h4>

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| 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 |
</div>
</details>
## Example Recipes

Recipe for the [List GitHub Repo Issues](https://instill.tech/instill-ai/pipelines/github-demo/playground) pipeline.

```yaml
version: v1beta
component:
  anthropic-0:
    type: anthropic
    task: TASK_TEXT_GENERATION_CHAT
    input:
      max-new-tokens: 1000
      model-name: claude-3-5-sonnet-20240620
      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
    setup:
      api-key: ${secret.INSTILL_SECRET}
  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
    instill-format: string
  repository-owner:
    title: Repository Owner
    description: Name of the repository owner i.e. instill-ai
    instill-format: string
output:
  result:
    title: Result
    value: ${anthropic-0.output.text}
```

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(bc base.Component) *component

Init returns an implementation of IConnector that interacts with Slack.

Types

type Client

type Client struct {
	*github.Client
	Repositories RepositoriesService
	PullRequests PullRequestService
	Issues       IssuesService
}

type Commit

type Commit struct {
	SHA     string       `json:"sha"`
	Message string       `json:"message"`
	Stats   *CommitStats `json:"stats,omitempty"`
	Files   []CommitFile `json:"files,omitempty"`
}

type CommitFile

type CommitFile struct {
	Filename string `json:"filename"`
	Patch    string `json:"patch"`
	CommitStats
}

type CommitStats

type CommitStats struct {
	Additions int `json:"additions"`
	Deletions int `json:"deletions"`
	Changes   int `json:"changes"`
}

type CreateIssueInput

type CreateIssueInput struct {
	RepoInfo
	Title string `json:"title"`
	Body  string `json:"body"`
}

type CreateIssueResp

type CreateIssueResp struct {
	Issue
}

type CreateReviewCommentInput

type CreateReviewCommentInput struct {
	RepoInfo
	PrNumber int                       `json:"pr-number"`
	Comment  github.PullRequestComment `json:"comment"`
}

type CreateReviewCommentResp

type CreateReviewCommentResp struct {
	ReviewComment
}

type CreateWebHookInput

type CreateWebHookInput struct {
	RepoInfo
	HookURL     string   `json:"hook-url"`
	HookSecret  string   `json:"hook-secret"`
	Events      []string `json:"events"`
	Active      bool     `json:"active"`
	ContentType string   `json:"content-type"` // including `json`, `form`
}

type CreateWebHookResp

type CreateWebHookResp struct {
	HookInfo
}

type GetCommitInput

type GetCommitInput struct {
	RepoInfo
	SHA string `json:"sha"`
}

type GetCommitResp

type GetCommitResp struct {
	Commit Commit `json:"commit"`
}

type GetIssueInput

type GetIssueInput struct {
	RepoInfo
	IssueNumber int `json:"issue-number"`
}

type GetIssueResp

type GetIssueResp struct {
	Issue
}

type GetPullRequestInput

type GetPullRequestInput struct {
	RepoInfo
	PrNumber float64 `json:"pr-number"`
}

type GetPullRequestResp

type GetPullRequestResp struct {
	PullRequest
}

type HookConfig

type HookConfig struct {
	URL         string `json:"url"`
	InsecureSSL string `json:"insecure-ssl"`
	Secret      string `json:"secret,omitempty"`
	ContentType string `json:"content-type"`
}

type HookInfo

type HookInfo struct {
	ID      int64      `json:"id"`
	URL     string     `json:"url"`
	PingURL string     `json:"ping-url"`
	TestURL string     `json:"test-url"`
	Config  HookConfig `json:"config"`
}

type Issue

type Issue struct {
	Number        int      `json:"number"`
	Title         string   `json:"title"`
	State         string   `json:"state"`
	Body          string   `json:"body"`
	Assignee      string   `json:"assignee"`
	Assignees     []string `json:"assignees"`
	Labels        []string `json:"labels"`
	IsPullRequest bool     `json:"is-pull-request"`
}

type ListIssuesInput

type ListIssuesInput struct {
	RepoInfo
	State         string `json:"state"`
	Sort          string `json:"sort"`
	Direction     string `json:"direction"`
	Since         string `json:"since"`
	NoPullRequest bool   `json:"no-pull-request"`
	PageOptions
}

type ListIssuesResp

type ListIssuesResp struct {
	Issues []Issue `json:"issues"`
}

type ListPullRequestsInput

type ListPullRequestsInput struct {
	RepoInfo
	State     string `json:"state"`
	Sort      string `json:"sort"`
	Direction string `json:"direction"`
	PageOptions
}

type ListPullRequestsResp

type ListPullRequestsResp struct {
	PullRequests []PullRequest `json:"pull-requests"`
}

type ListReviewCommentsInput

type ListReviewCommentsInput struct {
	RepoInfo
	PrNumber  int    `json:"pr-number"`
	Sort      string `json:"sort"`
	Direction string `json:"direction"`
	Since     string `json:"since"`
	PageOptions
}

type ListReviewCommentsResp

type ListReviewCommentsResp struct {
	ReviewComments []ReviewComment `json:"comments"`
}

type PageOptions

type PageOptions struct {
	Page    int `json:"page"`
	PerPage int `json:"per-page"`
}

type PullRequest

type PullRequest struct {
	ID                int64    `json:"id"`
	Number            int      `json:"number"`
	State             string   `json:"state"`
	Title             string   `json:"title"`
	Body              string   `json:"body"`
	DiffURL           string   `json:"diff-url,omitempty"`
	CommitsURL        string   `json:"commits-url,omitempty"`
	Commits           []Commit `json:"commits"`
	Head              string   `json:"head"`
	Base              string   `json:"base"`
	CommentsNum       int      `json:"comments-num"`
	CommitsNum        int      `json:"commits-num"`
	ReviewCommentsNum int      `json:"review-comments-num"`
}

type RepoInfo

type RepoInfo struct {
	Owner      string `json:"owner"`
	Repository string `json:"repository"`
}

type RepoInfoInterface

type RepoInfoInterface interface {
	// contains filtered or unexported methods
}

type ReviewComment

type ReviewComment struct {
	github.PullRequestComment
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL