# Jira and GitHub

> Connect Jira and GitHub, start flows when an issue or pull request changes, and act on them with plain steps that need no AI. Covers tokens and permissions, the two triggers and their filters, and every step.

Source: https://docs.go-lumen.ai/he/connectors/jira-and-github

A flow can start when a Jira issue or a GitHub issue or pull request changes, and can then create, update, comment on, label and read them. These are plain steps: no AI runs unless you add an agent.

-   10 minutes
-   Admin to connect
-   Checked every 5 minutes

You add Jira and GitHub from **Connectors**, under **MCP servers**, the same place where agents get their Jira and GitHub tools. One connection serves both flows and agents. See [Agent tools and MCP](https://docs.go-lumen.ai/he/ai/tools-and-mcp.md) for the agent side.

> **Availability:**
> 
> Jira and GitHub connections need your installation to have MCP switched on, and they can be added in workspaces in the `eu` region. Where they are not offered, the console shows them disabled and says why.

## Connect Jira

You need an Atlassian account and a Jira site such as `https://acme.atlassian.net`. Create the token first.

1.  Go to **id.atlassian.com**, open **Security**, then **API tokens**, and choose **Create API token with scopes**.
2.  Choose the app **Jira** and give exactly these scopes:

| Jira step or trigger | Scope |
| --- | --- |
| **A Jira issue changes**, **Get a Jira issue**, **Search Jira issues**, and any read before a change | `read:jira-work` |
| **Create a Jira issue**, **Update a Jira issue**, **Move a Jira issue**, **Comment on a Jira issue**, **Link Jira issues** | `write:jira-work` |
| An assignee given by email or name instead of an account id | `read:jira-user` |

If a token lacks a scope, the step fails and names the scope to add.

**Console:**

1.  Open **Connectors**, click **Add connection** and choose **Jira**.
2.  Give it a **Name**, such as `Team Jira`.
3.  Under **Atlassian email**, enter the address of the account the token belongs to. Under **Jira site**, enter your Jira address.
4.  Paste the whole token under **API token**.
5.  Click **Test connection**, then **Add Jira**. The test says which way Atlassian accepted the token and names the scope it lacks, if any. A scope that changes something (`write:jira-work`) cannot be checked without changing something, so a missing one shows on the first step that writes.

![The Add connection panel for Jira. An information box titled Create a scoped API token explains how to create the token at id.atlassian.com and that an organization admin must allow API token sign-in for the Rovo MCP server, with links to API tokens and Atlassian admin. Name holds Team Jira, Atlassian email holds dana@acme.example and Jira site holds https://acme.atlassian.net.](https://docs.go-lumen.ai/he/img/connectors/jira-and-github-01-jira-form.png)

*The Jira form. The token field is below the fold and is hidden as you type.*

**CLI:**

```bash title="Connect Jira from a terminal"
lumen connect jira team-jira \
  --set email=dana@acme.example \
  --set site=https://acme.atlassian.net \
  --secret-env apiToken=JIRA_API_TOKEN
```

The server address and sign-in mode are fixed by the connection type, so the terminal does not ask for them.

**YAML:**

```yaml title="team-jira.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
  name: team-jira
  namespace: tenant-acme
spec:
  classRef: {name: jira}
  config:
    url: https://mcp.atlassian.com/v2/mcp
    auth: basic
    email: dana@acme.example
    site: https://acme.atlassian.net
  credentials:
    secretRef: {name: lumen-conn-team-jira}
```

The token is the key `apiToken` of the Secret `lumen-conn-team-jira`. Write it through the console or `lumen connect`, never in the resource.

> **Use a separate connection for agents:**
> 
> The same connection can serve Atlassian's MCP server to agents, which wants its own token and scopes. Keep one Jira connection with the flow token above for flows and another for agents, so each token holds only what its user needs. The test of a flow connection may say agents cannot use its MCP tools. That is expected.

## Connect GitHub

GitHub takes a fine-grained personal access token, or signs in as a GitHub App.

| GitHub step or trigger | Token permission |
| --- | --- |
| **GitHub activity**, **Get a GitHub issue or pull request** | Issues: Read, Pull requests: Read |
| **List GitHub pull requests** | Pull requests: Read |
| **Comment on GitHub**, **Label on GitHub** | Issues: Read and write (Pull requests: Read and write for a pull request) |
| **Open a GitHub issue** | Issues: Read and write |

Limit the token to the repositories your flows should see. When it lacks a permission the step fails and names the one to add.

**Console:**

1.  Open **Connectors**, click **Add connection** and choose **GitHub**.
2.  Give it a **Name**, such as `Team GitHub`.
3.  Under **Sign in with**, choose **A personal access token** and paste it under **Token**, or choose **A GitHub App** (below).
4.  Click **Test connection**, then **Add GitHub**.

![The Add connection panel for GitHub. An information box titled Create a fine-grained token says to open Settings, Developer settings, Personal access tokens, then Fine-grained tokens, and to give read-only access to Contents, Issues, Pull requests, Metadata and Actions, with a link to a new fine-grained token. Name is empty. Sign in with offers A personal access token, selected, and A GitHub App. A Token field follows, hidden as you type.](https://docs.go-lumen.ai/he/img/connectors/jira-and-github-02-github-form.png)

*The GitHub form with a personal access token selected.*

**Sign in as a GitHub App** when comments, issues and pull requests should appear as the app's bot (`<app>[bot]`) instead of a person, and the connection should reach only the repositories the app is installed on. In GitHub, create the app with the permissions the flows need and no webhook, generate a private key (a `.pem` file), and install the app on your repositories with **Only select repositories**. Then choose **A GitHub App** and give:

| Field | What to enter |
| --- | --- |
| **App ID** | The number under About on the app's page. Not the client id. |
| **Installation ID** | The number at the end of the installation's settings address. Leave empty and Lumen finds the installation on the owner of the repositories you list. |
| **Repositories** | Optional, as `owner/name`. Limits each token Lumen makes to these. |
| **Permissions** | Optional, such as `contents:write`. Limits each token to these. |
| **Private key** | Choose the `.pem` file or paste it whole. |

Lumen signs a short-lived token with the key, exchanges it for an hour-long installation token narrowed to the repositories and permissions above, and renews it before it expires. The connection's card says who it signs in as and where the app is installed. If the installation misses a repository or a permission, the test fails and names it.

**CLI:**

```bash title="Connect GitHub with a token, or as a GitHub App"
lumen connect github team-github --secret-env token=GITHUB_TOKEN

lumen connect github team-github-app \
  --set signIn=app --set appId=123456 --set repositories=acme/website \
  --secret-file privateKey=./app.private-key.pem
```

The first line asks for a fine-grained token. The second signs in as an app and reads the key from the file you name, without showing it.

**YAML:**

```yaml title="team-github.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
  name: team-github
  namespace: tenant-acme
spec:
  classRef: {name: github}
  config:
    url: https://api.githubcopilot.com/mcp/readonly
    auth: bearer
    signIn: token
  credentials:
    secretRef: {name: lumen-conn-team-github}
```

The token is the key `token` of the Secret `lumen-conn-team-github`. With `signIn: app`, add `appId`, optionally `installationId`, `repositories` and `permissions`, and put the key in `privateKey` instead. Write secrets through the console or `lumen connect`.

## Start a flow

Both triggers are checked by Lumen every few minutes (5 by default, 1 to 60 in **Check every (minutes)**). An admin can click **Check Jira now** or **Check GitHub now** to check at once.

-   **Switching a trigger on starts from that moment.** To run the flow on what is already there, set **Import existing issues (newest)** or **Import existing open items (newest)**, up to 50, once.
-   **Each change starts one run, never two,** even when Lumen checks again or restarts. Several changes to one issue between two checks start one run with the issue as it is now.
-   **The text is outside data.** Issue titles, descriptions and comments are marked untrusted: an AI agent later in the flow reads them as information, never as instructions.

### A Jira issue changes

![The settings of the trigger A Jira issue changes. A line says Changes on the Jira connection Jira start this flow. Projects holds OPS. Start on has three checkboxes, Created, Moved to another status (checked) and Any other change, with the note that empty is all three. Only these issue types is empty. Only issues now in these statuses holds Done. Only issues with one of these labels is empty. More conditions (JQL) is empty, with an example, assignee = currentUser().](https://docs.go-lumen.ai/he/img/connectors/jira-and-github-03-jira-trigger.png)

*Watch the OPS project and start when an issue moves to Done.*

| Setting | What it does |
| --- | --- |
| **Projects** (`projects`) | Required. Project keys, such as `OPS`. Up to 20. |
| **Start on** (`events`) | **Created** (`created`), **Moved to another status** (`transitioned`) or **Any other change** (`updated`). Empty is all three. |
| **Only these issue types** (`issueTypes`) | Keep only issues of these types. |
| **Only issues now in these statuses** (`statuses`) | Keep only issues that are in one of these statuses now. |
| **Only issues with one of these labels** (`labels`) | Keep only issues that carry one of them. |
| **More conditions (JQL)** (`jql`) | A Jira query, added with AND. |
| **Start only when** (`when`) | A condition on the trigger's own fields, as for any trigger. |

The flow gets `event`, `key`, `summary`, `status`, `previousStatus` (for a move), `assignee` and `assigneeId`, `reporter`, `labels`, `project`, `issueType`, `priority`, `url`, `description`, `changedFields`, `createdAt`, `updatedAt` and `jiraConnection`.

### GitHub activity

![The settings of the trigger GitHub activity. A line says Activity on the GitHub connection GitHub starts this flow. Repositories holds acme/website. Start on has six checkboxes: Opened and Review requested are checked, and Labelled, Closed, Merged and Ready for review are not, with the note that empty is opened, labelled, closed and merged. Only offers Issues and Pull requests, with Pull requests checked. Only with one of these labels is empty and Check every (minutes) is 5.](https://docs.go-lumen.ai/he/img/connectors/jira-and-github-04-github-trigger.png)

*Start when a pull request in acme/website is opened or a review is requested.*

| Setting | What it does |
| --- | --- |
| **Repositories** (`repos`) | Required. `owner/name`, such as `acme/website`. Up to 20. |
| **Start on** (`events`) | **Opened**, **Labelled**, **Closed**, **Merged**, **Review requested** and **Ready for review**. Empty is opened, labelled, closed and merged: the last two start a flow only when you pick them. |
| **Only** (`kinds`) | **Issues**, **Pull requests**, or both when empty. |
| **Only with one of these labels** (`labels`) | Keep only items with one of them. For a labelled event, the label that was added. |
| **Start only when** (`when`) | A condition on the trigger's own fields. |

**Ready for review** is a draft pull request marked ready. A pull request opened ready starts the flow as **Opened**, never as ready for review. Each move out of draft starts one run, so marked ready, back to draft and ready again is two runs.

The flow gets `event`, `repo`, `number`, `kind` (`issue` or `pull_request`), `title`, `body`, `state`, `labels` and `label`, `author`, `actor`, `reviewer`, `url`, `merged`, `draft`, `createdAt`, `updatedAt` and `githubConnection`.

## Act on Jira and GitHub

Each step uses the connection you pick under its **Jira connection** or **GitHub connection** setting (`connectorRef`). Left empty, it uses the one the flow's trigger watches, or the workspace's only one. An item the trigger started from is the default **Issue** (Jira) or **Repository** and **Issue or pull request number** (GitHub), so a step after the trigger needs no setting for it.

**Jira**

| Step | Does |
| --- | --- |
| **Create a Jira issue** | Creates an issue from `project`, `issueType`, `summary`, `description`, `labels`, `assignee`, `priority` and an optional `parent` (an epic, or the issue a subtask sits under). Gives `key`, `issueId` and `url`. |
| **Update a Jira issue** | Changes the summary, description, labels (add or remove), assignee (or removes it) or priority. |
| **Move a Jira issue** | Moves the issue to a status by the name people see, such as `Done`. An issue already there is left as it is. |
| **Comment on a Jira issue** | Adds a comment. A step run again does not comment twice. |
| **Link Jira issues** | Links two issues by link type. It makes only the allowed types (Relates, Duplicate, Blocks and Clones unless you set **Allowed link types**), and a link already there, either way round, is left alone. |
| **Get a Jira issue** | Reads the issue's fields for later steps. |
| **Search Jira issues** | Runs a JQL search and returns up to 100 issues (`max`, default 20). |

Descriptions and comments take plain text with **bold**, lists, headings and links.

**GitHub**

| Step | Does |
| --- | --- |
| **Comment on GitHub** | Comments on an issue or pull request. A step run again does not comment twice. |
| **Label on GitHub** | Adds or removes labels. |
| **Open a GitHub issue** | Opens an issue with a title, description, labels and assignees. |
| **Get a GitHub issue or pull request** | Reads its fields. |
| **List GitHub pull requests** | Lists a repository's pull requests (`state`, `max` up to 100). |

There is no step that merges or pushes.

If Jira or GitHub limits how fast Lumen may ask, Lumen waits and tries again. A change that may or may not have gone through (the service did not answer clearly) is not repeated, and the step tells you to check first.

## Examples

The first flow turns a supplier email into a Jira issue. The second starts from a webhook that a deploy script calls with a pull request number, and labels and comments on that pull request.

```yaml title="jira-supplier-requests.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: jira-supplier-requests
  namespace: tenant-acme
spec:
  displayName: Open a Jira issue for each supplier request
  triggers:
    - id: email
      ref: {name: email-arrives}
      connectorRef: {name: invoices-inbox}
      config: {attachments: together, requireAttachment: false}
      next: [ticket]
  nodes:
    - id: ticket
      stepRef: {name: jira-create-issue}
      config:
        connectorRef: team-jira
        project: OPS
        issueType: Task
        summary: "Supplier request: {email.subject}"
        description: "From {email.from}. {email.body}"
        labels: [supplier]
```

```yaml title="github-deploy-label.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: github-deploy-label
  namespace: tenant-acme
spec:
  displayName: Label and comment on a deployed pull request
  triggers:
    - id: deploy
      ref: {name: webhook-received}
      connectorRef: {name: deploy-hook}
      config:
        mapping:
          - {name: repo, type: string, jsonPath: $.repo}
          - {name: pull, type: string, jsonPath: $.pull}
      next: [label]
  nodes:
    - id: label
      stepRef: {name: github-labels}
      config:
        connectorRef: team-github
        repo: "{deploy.repo}"
        number: "{deploy.pull}"
        add: [deployed]
      next: [note]
    - id: note
      stepRef: {name: github-comment}
      config:
        connectorRef: team-github
        repo: "{deploy.repo}"
        number: "{deploy.pull}"
        body: "Deployed to production."
```

The second flow uses this webhook connection, which a deploy script calls. [HTTP and webhooks](https://docs.go-lumen.ai/he/connectors/http-and-webhooks.md) explains how it works. When a step names no repository or number, it uses the item that started the flow.

```yaml title="deploy-hook.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
  name: deploy-hook
  namespace: tenant-acme
spec:
  classRef: {name: webhook}
  config: {signature: none}
```

The triggers of this page are written like any other. Put these in a flow's `triggers` list, and read their fields as `{pr.title}` or `{issue.key}` after the trigger's `id`:

```yaml title="Triggers, as fragments of a flow"
triggers:
  - id: issue
    ref: {name: jira-issue-changed}
    connectorRef: {name: team-jira}
    config:
      projects: [OPS]
      events: [transitioned]
      statuses: [Done]
    next: [first-step]
  - id: pr
    ref: {name: github-activity}
    connectorRef: {name: team-github}
    config:
      repos: [acme/website]
      events: [opened, review_requested]
      kinds: [pull_request]
      pollMinutes: 5
    next: [first-step]
```

## Next steps

[Agent tools and MCPGive agents Jira and GitHub tools, with allow, ask and block per tool.](https://docs.go-lumen.ai/he/ai/tools-and-mcp.md)[TriggersEvery way to start a flow, and the Start only when condition.](https://docs.go-lumen.ai/he/build/triggers.md)[Branches and filtersRoute a run by the issue's labels, status or priority.](https://docs.go-lumen.ai/he/build/branches-and-filters.md)[When a run failsWhat a missing scope or permission looks like in a run.](https://docs.go-lumen.ai/he/build/when-a-run-fails.md)
