> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub integration

[Back to list of integrations](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems.md)

Use the GitHub integration to let agents manage issues, comment on pull requests, commits, and discussions, manage branches, and look up users through Action Tools.

| Authentication | Actions | Workflow triggers |
| - | - | - |
| OAuth 2.0, API Key | [17](#supported-actions) | [14](#workflow-triggers) |

## Supported actions

Actions are GitHub operations that an agent runs as Action Tools during a conversation. You can also run them from an [Integration node](https://koreai.mintlify.site/agent-platform/workflows.md#integration-node) in a workflow.

| Group | Actions |
| - | - |
| Issues | [Create Issue](#create-issue), [Get issue information](#get-issue-information), [Update Issue](#update-issue), [Find Issue](#find-issue), [Add Labels to Issue](#add-labels-to-issue), [Create comment on a issue](#create-comment-on-a-issue), [Lock issue](#lock-issue), [Unlock issue](#unlock-issue) |
| Reviews and discussions | [Create Pull Request Review Comment](#create-pull-request-review-comment), [Create Commit Comment](#create-commit-comment), [Create Discussion Comment](#create-discussion-comment) |
| Branches | [Create Branch](#create-branch), [Find Branch](#find-branch), [Delete Branch](#delete-branch) |
| Users and advanced | [Find User](#find-user), [Raw GraphQL query](#raw-graphql-query), [Custom API Call](#custom-api-call) |

## Workflow triggers

Triggers are GitHub events that start a workflow automatically. Select them as [app triggers](https://koreai.mintlify.site/agent-platform/workflows.md#app-triggers) when you configure a workflow.

| Trigger | Fires when |
| - | - |
| New Pull Request | A pull request has activity. |
| New Issue | An issue has activity. |
| New Comment Posted | A comment is posted on a discussion. |
| New Discussion | A discussion has activity. |
| New Review Request | You're asked to review a pull request. |
| New Mention | You're mentioned in a comment. |
| Push | A branch receives a push, including commits, tags, branch or tag deletions, and repositories created from a template. |
| New Commit | A commit is pushed. |
| New Branch | A branch is created. |
| New Release | A release is added. |
| New Label | A label is created. |
| New Milestone | A milestone is created. |
| New Collaborator | A collaborator is added. |
| New Star | A repository's stars change. |

## Set up the integration

**1. Get GitHub credentials**

For **OAuth 2.0**, create a [GitHub OAuth app](https://github.com/settings/developers), set its callback URL to the Artemis **Callback URL**, and copy the **Client ID** and **Client Secret**. For **API Key**, create a [personal access token](https://github.com/settings/tokens) with access to the repositories the agent uses.

**2. Create the auth profile**

In **Integrations**, select **GitHub** > **Connect**. On **Project Auth Profiles**, select **New Profile** > **Integration Profile** > **GitHub** > **Continue**. Select an **Auth Type**, enter the credentials, and select **Create Profile**. For OAuth 2.0, select **Authorize**.

| Auth Type | Fields |
| - | - |
| **OAuth 2.0** | **Client ID** and **Client Secret**. Artemis pre-fills the GitHub endpoints and the scopes `repo`, `admin:org`, and `admin:repo_hook`. |
| **API Key** | Paste the token into **API Key**. Keep the `authorization` header, `Bearer ` prefix, and `x-github-api-version` header (`2022-11-28`). |

**Usage Mode**: **Preconfigured** shares one authorization across users; **JIT** and **Preflight** ask each user to authorize, during or before the session. See [Auth profiles](https://koreai.mintlify.site/agent-platform/administration/integrations-settings.md#auth-profiles).

**3. Create the action tool**

In **Tools**, select **New Tool** > **Action** > **GitHub** > **Continue**. Select the **Action** and **Auth Profile**, set parameter defaults (leave a value empty for the agent to supply at runtime), and select **Create Tool**. Then [assign the tool to an agent](https://koreai.mintlify.site/agent-platform/tools/actions.md#assign-an-action-to-an-agent).

## Action reference

### Issues

> [accordion] Create Issue
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `title` | string | Title. |
> | `description` | string | Description. |
> | `labels` | array | Labels. |
> | `assignees` | array | Assignees. |

> [accordion] Get issue information
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `issue_number` | number | Issue number. |

> [accordion] Update Issue
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `issue_number` | enum | Issue. |
> | `title` | string | Title. |
> | `body` | string | Body. |
> | `state` | enum | New state. |
> | `state_reason` | enum | Reason for the state change. Used only when state changes. |
> | `milestone` | enum | Milestone. |
> | `labels` | array | Labels. |
> | `assignees` | array | Assignees. |

> [accordion] Find Issue
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `title` | string | Title. |
> | `state` | enum | State filter. |

> [accordion] Add Labels to Issue
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `issue_number` | enum | Issue. |
> | `labels` | array | Labels to add. |

> [accordion] Create comment on a issue
>
> Also works for pull requests.
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `issue_number` | number | Issue or pull request number. |
> | `comment` | string | Comment. |

> [accordion] Lock issue
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `issue_number` | number | Issue number. |
> | `lock_reason` | enum | Reason for locking. |

> [accordion] Unlock issue
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `issue_number` | number | Issue number. |

### Reviews and discussions

> [accordion] Create Pull Request Review Comment
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `pull_number` | number | Pull request number. |
> | `commit_id` | string | Commit SHA. |
> | `path` | string | Relative file path. |
> | `body` | string | Comment. |
> | `position` | number | Position in the diff. |

> [accordion] Create Commit Comment
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `sha` | string | Commit SHA. |
> | `body` | string | Comment. |
> | `path` | string | Optional. Relative file path. |
> | `position` | number | Optional. Line index in the diff. |

> [accordion] Create Discussion Comment
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `discussion_number` | number | Discussion number. |
> | `body` | string | Comment. Supports Markdown. |

### Branches

> [accordion] Create Branch
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `source_branch` | enum | Source branch. |
> | `new_branch_name` | string | New branch name, for example `feature/new-design`. |

> [accordion] Find Branch
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `branch` | string | Branch name. |

> [accordion] Delete Branch
>
> | Parameter | Type | Description |
> | - | - | - |
> | `repository` | enum | Repository. |
> | `branch` | enum | Branch. |

### Users and advanced

> [accordion] Find User
>
> | Parameter | Type | Description |
> | - | - | - |
> | `username` | string | GitHub login. |

> [accordion] Raw GraphQL query
>
> | Parameter | Type | Description |
> | - | - | - |
> | `query` | string | GraphQL query. |
> | `variables` | object | Query variables. |

> [accordion] Custom API Call
>
> | Parameter | Type | Description |
> | - | - | - |
> | `url` | object | Endpoint URL. |
> | `method` | enum | HTTP method. |
> | `headers` | object | Additional request headers. Artemis injects the authorization header. |
> | `queryParams` | object | Query parameters. |
> | `body_type` | enum | Body type. Default: `None`. |
> | `body` | object | Request body. |
> | `response_is_binary` | boolean | Turn on for binary responses. Default: `False`. |
> | `failsafe` | boolean | Returns no error when the call fails. |
> | `timeout` | number | Timeout, in seconds. |
> | `followRedirects` | boolean | Follows HTTP redirects. Default: `False`. |

## Troubleshoot common issues

| Issue | Resolution |
| - | - |
| `Bad credentials` | Regenerate the token, or authorize the OAuth profile again. |
| `Resource not accessible` | Grant the token or app access to the repository and organization. |
| Repository list is empty | For organization repositories, approve the OAuth app in the organization's settings. |
| Triggers don't fire | Confirm the account can manage webhooks on the repository (`admin:repo_hook`). |

**Related articles:**

* [Auth profiles](https://koreai.mintlify.site/agent-platform/administration/integrations-settings.md#auth-profiles)
* [Action Tools](https://koreai.mintlify.site/agent-platform/tools/actions.md)
* [Integration node](https://koreai.mintlify.site/agent-platform/workflows.md#integration-node)
* [GitHub REST API](https://docs.github.com/en/rest)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.