# GitHub

> Manage GitHub branches, issues, and pull requests with a personal access token.

App · Code Repositories · 17 actions · 7 triggers. Web page: https://docs.lodol.com/docs/integrations/github

## Triggers

Start a workflow when something happens in GitHub. See [how triggers work](https://docs.lodol.com/docs/concepts/triggers.md).

### New pull request

Runs when a pull request is opened in a GitHub repository.

**Filters**: Narrow which events start a run.

- `owner` (required)
- `repo` (required)
- `base`

**Event fields**: What a run starts with. Later steps read each field with an @ reference.

- `number` (number)
- `title` (text)
- `state` (text)
- `html_url` (text)
- `head` (text)
- `base` (text)
- `draft` (true/false)
- `user` (text)
- `created_at` (text)
- `updated_at` (text)

### Updated pull request

Runs when a pull request in a GitHub repository is updated.

**Filters**: Narrow which events start a run.

- `owner` (required)
- `repo` (required)
- `base`

**Event fields**: What a run starts with. Later steps read each field with an @ reference.

- `number` (number)
- `title` (text)
- `state` (text)
- `html_url` (text)
- `head` (text)
- `base` (text)
- `draft` (true/false)
- `user` (text)
- `created_at` (text)
- `updated_at` (text)

### New issue

Runs when an issue is opened in a GitHub repository.

**Filters**: Narrow which events start a run.

- `owner` (required)
- `repo` (required)
- `label`

**Event fields**: What a run starts with. Later steps read each field with an @ reference.

- `number` (number)
- `title` (text)
- `state` (text)
- `html_url` (text)
- `body` (text)
- `user` (text)
- `labels` (list)
- `assignees` (list)
- `created_at` (text)
- `updated_at` (text)

### Updated issue

Runs when an issue in a GitHub repository is updated.

**Filters**: Narrow which events start a run.

- `owner` (required)
- `repo` (required)
- `label`

**Event fields**: What a run starts with. Later steps read each field with an @ reference.

- `number` (number)
- `title` (text)
- `state` (text)
- `html_url` (text)
- `body` (text)
- `user` (text)
- `labels` (list)
- `assignees` (list)
- `created_at` (text)
- `updated_at` (text)

### New push to branch

Runs for each new commit pushed to a branch of a GitHub repository.

**Filters**: Narrow which events start a run.

- `owner` (required)
- `repo` (required)
- `branch`

**Event fields**: What a run starts with. Later steps read each field with an @ reference.

- `sha` (text)
- `message` (text)
- `author` (text)
- `branch` (text)
- `html_url` (text)
- `committed_at` (text)

### New release

Runs when a release is created in a GitHub repository.

**Filters**: Narrow which events start a run.

- `owner` (required)
- `repo` (required)

**Event fields**: What a run starts with. Later steps read each field with an @ reference.

- `id` (number)
- `tag_name` (text)
- `name` (text)
- `body` (text)
- `draft` (true/false)
- `prerelease` (true/false)
- `html_url` (text)
- `author` (text)
- `published_at` (text)

### New review request

Runs when someone is asked to review a pull request in a GitHub repository.

**Filters**: Narrow which events start a run.

- `owner` (required)
- `repo` (required)
- `reviewer`

**Event fields**: What a run starts with. Later steps read each field with an @ reference.

- `number` (number)
- `title` (text)
- `state` (text)
- `html_url` (text)
- `head` (text)
- `base` (text)
- `draft` (true/false)
- `user` (text)
- `created_at` (text)
- `updated_at` (text)
- `reviewer` (text)

## Actions

### Add label to issue

Add one or more labels to an issue, keeping the labels it already has.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Issue (`issue_number`, number, required): The open issue to act on.
- Labels (`labels`, text, required): The labels to add. Pick one, or enter several separated by commas.

**Outputs**

- `added` (list)
- `issue_number` (number)
- `labels` (list)

**Example output**

```json
{
  "added": [
    "bug"
  ],
  "issue_number": 42,
  "labels": [
    "bug",
    "needs-triage"
  ]
}
```

### Close pull request

Close a pull request without merging it. GitHub does not allow pull requests to be deleted, so closing is the way to shut one down.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Pull request (`pull_number`, number, required): The open pull request to act on.

**Outputs**

- `html_url` (text)
- `id` (number)
- `number` (number)
- `state` (text)
- `title` (text)

**Example output**

```json
{
  "base": "main",
  "draft": false,
  "head": "feature/new-widget",
  "html_url": "https://github.com/octocat/hello-world/pull/7",
  "id": 111,
  "merged": false,
  "number": 7,
  "state": "closed",
  "title": "Add new widget"
}
```

### Create branch

Create a new branch in a repository. Points the new branch at the tip of an existing branch (defaults to the repository's default branch) unless you supply a specific commit SHA.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- New branch name (`branch`, text, required): The name for the new branch (without the 'refs/heads/' prefix).
- Source branch (`from_branch`, text): The existing branch to base the new one on. Defaults to the repository's default branch when not set.
- Source commit SHA (`sha`, text): A specific commit SHA to point the new branch at. Takes precedence over the source branch when provided.

**Outputs**

- `name` (text)
- `ref` (text)
- `sha` (text)

**Example output**

```json
{
  "name": "feature/new-widget",
  "ref": "refs/heads/feature/new-widget",
  "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd"
}
```

### Create comment

Add a comment to an issue or pull request. Use the issue or pull request number, since both share the same numbering.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Issue (`issue_number`, number, required): The open issue to comment on. To comment on a pull request, reference its number from an earlier step.
- Comment (`body`, text, required): The text of the comment.

**Outputs**

- `body` (text)
- `html_url` (text)
- `id` (number)
- `user` (object)

**Example output**

```json
{
  "body": "This is a comment.",
  "html_url": "https://github.com/octocat/hello-world/issues/42#issuecomment-456",
  "id": 456,
  "user": {
    "login": "commenter"
  }
}
```

### Create issue

Create a new issue in a repository.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Title (`title`, text, required): The title of the new issue.
- Description (`body`, text): The main text of the issue.
- Labels (`labels`, list): Labels to add to the issue.
- Assignees (`assignees`, list): The people to assign to the issue.

**Outputs**

- `html_url` (text)
- `id` (number)
- `number` (number)
- `state` (text)
- `title` (text)

**Example output**

```json
{
  "html_url": "https://github.com/octocat/hello-world/issues/43",
  "id": 123,
  "number": 43,
  "state": "open",
  "title": "New Feature Request"
}
```

### Create pull request

Open a new pull request to merge one branch into another.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Title (`title`, text, required): The title of the pull request.
- Source branch (head) (`head`, text, required): The branch with your changes that you want to merge in. For a cross-fork request, reference a 'username:branch' value from an earlier step.
- Target branch (base) (`base`, text, required): The branch you want your changes merged into.
- Description (`body`, text): The main text describing the pull request.
- Create as draft (`draft`, true/false): Open the pull request as a draft that isn't ready to merge. Default: `false`.

**Outputs**

- `base` (text)
- `draft` (true/false)
- `head` (text)
- `html_url` (text)
- `id` (number)
- `merged` (true/false)
- `number` (number)
- `state` (text)
- `title` (text)

**Example output**

```json
{
  "base": "main",
  "draft": false,
  "head": "feature/new-widget",
  "html_url": "https://github.com/octocat/hello-world/pull/7",
  "id": 111,
  "merged": false,
  "number": 7,
  "state": "open",
  "title": "Add new widget"
}
```

### Delete branch

Delete a branch from a repository.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Branch name (`branch`, text, required): The name of the branch to delete (without the 'refs/heads/' prefix).

**Outputs**

- `branch` (text)
- `deleted` (true/false)

**Example output**

```json
{
  "branch": "feature/old-widget",
  "deleted": true
}
```

### Delete issue

Permanently delete an issue. GitHub only allows this through its GraphQL API, and the connected account must be able to delete issues in the repository (an organization owner, or a repository admin or maintainer).

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Issue (`issue_number`, number, required): The open issue to delete.

**Outputs**

- `deleted` (true/false)
- `issue_number` (number)

**Example output**

```json
{
  "deleted": true,
  "issue_number": 42
}
```

### Get branch

Get details of a specific branch, including its latest commit SHA.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Branch name (`branch`, text, required): The name of the branch to look up.

**Outputs**

- `html_url` (text)
- `name` (text)
- `protected` (true/false)
- `sha` (text)

**Example output**

```json
{
  "html_url": "https://github.com/octocat/hello-world/tree/main",
  "name": "main",
  "protected": true,
  "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd"
}
```

### Get issue

Get details of a specific issue.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Issue (`issue_number`, number, required): The open issue to look up.

**Outputs**

- `body` (text)
- `html_url` (text)
- `id` (number)
- `number` (number)
- `state` (text)
- `title` (text)

**Example output**

```json
{
  "body": "Description of the bug.",
  "html_url": "https://github.com/octocat/hello-world/issues/42",
  "id": 789,
  "number": 42,
  "state": "open",
  "title": "Bug in feature X"
}
```

### Get organization

Get the public profile details of a GitHub organization.

**Inputs**

- Organization (`org`, text, required): The login (short name) of the organization.

**Outputs**

- `description` (text)
- `html_url` (text)
- `id` (number)
- `login` (text)
- `name` (text)
- `public_repos` (number)

**Example output**

```json
{
  "description": "How people build software.",
  "html_url": "https://github.com/github",
  "id": 9919,
  "login": "github",
  "name": "GitHub",
  "public_repos": 484
}
```

### Get pull request

Get details of a specific pull request.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Pull request (`pull_number`, number, required): The open pull request to act on.

**Outputs**

- `base` (text)
- `body` (text)
- `draft` (true/false)
- `head` (text)
- `html_url` (text)
- `id` (number)
- `merged` (true/false)
- `number` (number)
- `state` (text)
- `title` (text)

**Example output**

```json
{
  "base": "main",
  "body": "This pull request adds the new widget.",
  "draft": false,
  "head": "feature/new-widget",
  "html_url": "https://github.com/octocat/hello-world/pull/7",
  "id": 111,
  "merged": false,
  "number": 7,
  "state": "open",
  "title": "Add new widget"
}
```

### Get user

Get the public profile details of a GitHub user. Leave the username blank to fetch the account the token belongs to.

**Inputs**

- Username (`username`, text): The GitHub username to look up. Leave blank for the connected (authenticated) account.

**Outputs**

- `html_url` (text)
- `id` (number)
- `login` (text)
- `name` (text)
- `public_repos` (number)
- `type` (text)

**Example output**

```json
{
  "html_url": "https://github.com/octocat",
  "id": 583231,
  "login": "octocat",
  "name": "The Octocat",
  "public_repos": 8,
  "type": "User"
}
```

### Lock issue

Lock an issue's conversation so only repository collaborators can comment on it.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Issue (`issue_number`, number, required): The open issue to act on.
- Reason (`lock_reason`, text): Why the conversation is being locked. Optional. One of: `off-topic` (Off topic), `too heated`, `resolved`, `spam`.

**Outputs**

- `issue_number` (number)
- `lock_reason` (text)
- `locked` (true/false)

**Example output**

```json
{
  "issue_number": 42,
  "lock_reason": "resolved",
  "locked": true
}
```

### Remove label from issue

Remove one label from an issue, leaving its other labels alone.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Issue (`issue_number`, number, required): The open issue to act on.
- Label (`label`, text, required): The label to remove from the issue.

**Outputs**

- `issue_number` (number)
- `labels` (list)
- `removed` (text)

**Example output**

```json
{
  "issue_number": 42,
  "labels": [
    "bug"
  ],
  "removed": "needs-triage"
}
```

### Unlock issue

Unlock an issue's conversation so anyone can comment again.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Issue (`issue_number`, number, required): The open issue to act on.

**Outputs**

- `issue_number` (number)
- `locked` (true/false)

**Example output**

```json
{
  "issue_number": 42,
  "locked": false
}
```

### Update issue

Update an existing issue. Only the fields you fill in are changed. Labels and assignees replace the issue's current lists; use 'Add label to issue' / 'Remove label from issue' to change one label at a time.

**Inputs**

- Repository owner (`owner`, text, required): The username or organization that owns the repository (the part before the '/' in 'owner/repo').
- Repository name (`repo`, text, required): The name of the repository (the part after the '/' in 'owner/repo').
- Issue (`issue_number`, number, required): The open issue to act on.
- Title (`title`, text): A new title for the issue. Leave blank to keep the current one.
- Description (`body`, text): A new description for the issue. Leave blank to keep the current one.
- State (`state`, text): Reopen or close the issue. Leave blank to keep its current state. One of: `open`, `closed`.
- Labels (`labels`, list): The complete set of labels the issue should end up with. Leave blank to keep its current labels.
- Assignees (`assignees`, list): The complete set of assignees the issue should end up with. Leave blank to keep its current assignees.

**Outputs**

- `assignees` (list)
- `body` (text)
- `html_url` (text)
- `id` (number)
- `labels` (list)
- `locked` (true/false)
- `number` (number)
- `state` (text)
- `title` (text)

**Example output**

```json
{
  "assignees": [
    "octocat"
  ],
  "body": "The widget stops responding after a resize.",
  "html_url": "https://github.com/octocat/hello-world/issues/42",
  "id": 1001,
  "labels": [
    "bug"
  ],
  "locked": false,
  "number": 42,
  "state": "open",
  "title": "Fix the widget"
}
```
