# GitHub issues

A card linked to a GitHub issue closes it when moved into the done column, and moves there when the issue is closed as completed.

A card can be linked to one GitHub issue. The card and the issue then keep one fact in step, whether the work is done, and nothing else passes between them.

## Connect a repository

An owner of the team connects repositories, from those their GitHub account reaches.

1. Open **Settings**. Under **GitHub**, choose **Connect GitHub** if it shows: your Arcadia account connects your GitHub account, asks you to confirm, and brings you back.
2. Choose **Connect repository** and pick a repository from the list. If one is missing, **Refresh access**, at the top of the list, asks your Arcadia account again.
3. Confirm with **Connect repository**. The team then sees the repository's issue numbers, titles and states, and its members close and reopen the issues they link.

A connected repository works while the person who connected it is in the team, their GitHub connection holds, and they still reach it. If **Settings** shows **Connect GitHub again**, that connection must be made again: choose it. To take a repository out, choose the × beside it in **Settings**: whoever connected it does that, and so do the owners. Leaving the team takes out the repositories you connected.

## Import open issues

After an owner connects a repository, open the **Board menu** and choose **Import from GitHub**.

Choose the repository and a destination column. Search by issue title or number, select the open issues you want and choose **Import**. Issues already linked to cards cannot be selected.

Crew creates linked cards and reports which issues it imported. Importing does not change anything on GitHub.

## Link an issue to a card

Once the team has a repository, every card that is not archived has **Link issue**.

1. Open the card and choose **Link issue**.
2. Paste the issue's address and press `⏎`. Or type to filter the open issues of the team's repositories, by words of a title, a repository's name or a number, and choose one.

The card then shows the issue: its repository and number, which open it on GitHub, its state (**Open**, **Closed**, **Not planned** or **Duplicate**), its title, and **Unlink**. On the board, the card's line shows the issue's number with a mark of its state.

A card has one issue at most, and an issue is linked to one card of the team at most. **Unlink** takes the link away and changes nothing on GitHub.

## What moves what

| When | Then |
|---|---|
| The card moves into its board's done column | The issue is closed as completed |
| The card moves out of the done column | The issue is reopened |
| The issue is closed as completed on GitHub | The card moves to the top of the done column |
| The issue is reopened on GitHub | The card goes back to the column it came from |
| The issue is closed for another reason, such as not planned | The card stays where it is, and shows the state |

Nothing else passes between them: not the title, the text, who has it, the labels or the comments. On a board without a done column, the card only shows the issue's state ([The done column](https://staging.crew.arcadia.is/docs/boards#done-column)).

Crew reads the issue again when someone opens the card, and on its own in between, so a change made on GitHub reaches the card at its next reading.

## Whose name a change carries

- A move in Crew closes or reopens the issue in the name of the person who moved the card, when they have connected GitHub in Crew and reach the repository. An agent's move counts as its person's. Otherwise Arcadia's app on GitHub makes the change, with the access of whoever connected the repository.
- A change on GitHub moves the card as GitHub, acting for whoever connected the repository, and **Activity** shows it that way.

## When something stands in the way

Under its issue, a card names what stands in the way:

| The card says | What it means |
|---|---|
| **GitHub is not connected** | No connection covers this repository: an owner connects it under **Settings** |
| **Connect GitHub again** | The GitHub connection must be made again at the Arcadia account |
| **GitHub refuses this** | GitHub does not allow it with the access it was given |
| **GitHub cannot be reached** | Crew tries again by itself |

When Crew has asked GitHub as often as it may for you, the page says **Try again in 20 seconds**. That is a wait, no failure. The dialog that connects a repository connects by itself when the wait ends, if it is still open. **Cancel** stops it.

Only **GitHub cannot be reached** is tried again by itself: the others wait for someone to act. When a repository is taken out, or the access it stood on ends, its cards keep their links, nothing more changes, and each card says why.

## Agents and issues

An agent with **Read and change** links a card to an issue and unlinks it, and its moves close and reopen issues as its person's would. It can also [preview and import open issues](https://staging.crew.arcadia.is/docs/tools#import-github-issues) from a connected repository. It cannot connect or remove a repository.
