GitHub Issues
The github-issues tracker reads issues from github.com and GitHub Enterprise Server through the REST API: fields, comments, links, timeline history and search, including GitHub's own search syntax. It is read-only, and it works without a token for public repositories. This page has the profile entry, the reference forms, and the places where GitHub's model differs from a classic tracker.
Profile entry
- id: issues
type: github-issues
owner: acme
repos: [web-app, admin-panel]
token_env: GITHUB_TOKENA ticket key is repo#number:
safran ticket web-app#412 --comments
safran ticket acme/web-app#412
safran ticket https://github.com/acme/web-app/issues/412import { createSafran } from "@safran/core";
await using safran = await createSafran({ profile: "safran.yaml" });
const { tracker, key } = safran.tickets.resolve("acme/web-app#412");
console.log(tracker.id, key); // issues web-app#412
const issue = await safran.tickets.get(key);
console.log(issue.title, issue.status, issue.labels, issue.fields.Milestone);Authentication
token_env is optional. When set, the token is sent as Authorization: Bearer; the variable must then hold a token, and a missing one is AUTH_MISSING. When the field is left out, requests are anonymous, which is enough for public repositories.
The source names no scope. The token needs read access to the issues of the listed repositories. Without a token, a 404 is reported with an extra hint that private repositories need token_env.
Public repositories, no token
- id: issues
type: github-issues
owner: acme
repos: [web-app]GitHub Enterprise Server
- id: issues
type: github-issues
owner: acme
repos: [web-app, admin-panel]
token_env: GITHUB_TOKEN
url: https://github.acme.test/api/v3url is the API root. Issue links are recognised on the web host that belongs to it.
Configuration reference
| Field | Type | Default | Required | Meaning |
|---|---|---|---|---|
id | string | yes | Name of this entry. | |
type | "github-issues" | yes | Selects this plugin. | |
owner | string | yes | User or organization that owns the repositories. | |
repos | string[] | [] | no | Repository names, without the owner. Empty means any repository of the owner. |
projects | string[] | [] | no | Same meaning as repos; both lists are merged. It exists because every tracker entry has projects. |
token_env | variable name | no | Variable holding a token. Leave out for public repositories. | |
url | URL | https://api.github.com | no | API root. GitHub Enterprise Server: https://HOSTNAME/api/v3. |
Ticket references
The canonical key is web-app#412: the repository name as configured, #, the number.
| Input | With repos: [web-app, admin-panel] | With repos: [web-app] | With no repos |
|---|---|---|---|
web-app#412 | web-app#412 | web-app#412 | web-app#412 |
acme/web-app#412 | web-app#412 | web-app#412 | web-app#412 |
Web-App#0412 | web-app#412 | web-app#412 | Web-App#412 |
other/web-app#412 (another owner) | not matched | not matched | not matched |
ledger#412 | not matched | not matched | ledger#412 |
#412 | not matched | web-app#412 | not matched |
412 | not matched | not matched | not matched |
AB#412 | not matched | not matched | not matched |
https://github.com/acme/web-app/issues/412 | web-app#412 | web-app#412 | web-app#412 |
https://api.github.com/repos/acme/web-app/issues/412 | web-app#412 | web-app#412 | web-app#412 |
https://github.com/acme/web-app/pull/412 | not matched | not matched | not matched |
How it stays out of other trackers' way:
#412only means something with exactly one repository. With several, or with none listed, it names no issue and is not matched.- A bare number is never matched. That is Azure Boards' form; Azure Boards in turn leaves
#412to this tracker, so the two can share a profile. AB#412is Azure Boards' as well, unless a repository namedABis configured here. Then both trackers claim it and the caller has to name one:issues:AB#412./pull/412URLs are not matched. Pull request URLs belong to the code host.- Two
github-issuesentries that cover the same repository do collide. Give each entry its ownrepos.
A reference that turns out to be a pull request (web-app#412 where 412 is a pull request) is still returned, as a ticket with type: "pull request": a number in a commit message does not say which of the two it means.
What a ticket contains
Ticket field | Source in GitHub |
|---|---|
key, title, url | repo#number, title, html_url |
type | pull request for a pull request; otherwise the issue type's name, or issue |
status, statusCategory | open → todo; closed → done. GitHub has no "in progress". |
project | The repository name |
description | The issue body (Markdown) |
labels | Label names |
assignee, reporter | The assignee (the first one when there are several), the author |
parent | The parent issue, when the issue is a sub-issue |
resolvedAt | closed_at |
priority is not set.
Ticket.fields
Present only when they have a value: State reason (completed, not_planned, …), Milestone, Assignees (all logins), Comments (the count), Sub-issues (total and completed), Draft (for draft pull requests). There is no custom_fields option.
Search
A neutral TicketSearchQuery becomes a GitHub search query.
| Query field | Search query |
|---|---|
text | Every word quoted, followed by in:title,body |
| always | is:issue (neutral searches never return pull requests) |
projects (or the entry's repositories when absent) | One repo:acme/<name> per repository; user:acme when none are configured |
statusCategories | todo → is:open, done → is:closed, both → no qualifier |
updatedSince | updated:>=<ISO time> |
Results are sorted by update time, newest first. Things to know:
- Quoting. Because every word is quoted, qualifiers (
repo:,is:), negation and boolean operators typed intotextstay plain words. At mostGITHUB_MAX_QUERY_TEXTcharacters of text are used; words beyond that are dropped. in_progressalone matches nothing. A search that asks only forin_progressreturns an empty page without a request.- Projects of other trackers are ignored. In a search across all trackers with
projects: ["PAY"],PAYis not a repository here; when none of the requested projects is one of this tracker's repositories, the page is empty. - Many repositories. Above
GITHUB_MAX_REPO_QUALIFIERSrepositories the search runs owner-wide (user:acme) and results are cut back to the configured repositories afterwards, so pages can be shorter thanlimit. - The search API serves at most
GITHUB_SEARCH_CAPresults per query; paging stops there.
Native search syntax
import { createSafran } from "@safran/core";
await using safran = await createSafran({ profile: "safran.yaml" });
const page = await safran.tickets.search({ native: "repo:acme/web-app is:issue is:open label:bug sort:updated" }, { tracker: "issues" });
for (const item of page.items) console.log(item.key, item.type, item.title);native is sent as written: it is not restricted to the configured owner or repositories, and it may return pull requests. A query GitHub rejects (HTTP 400 or 422) becomes INVALID_INPUT with GitHub's message in the hint.
Comments, links, history
- Comments are the issue's comments, 100 per page at most.
- Links returns the parent issue; sub-issues (up to 100); cross-references from the timeline, where an issue that mentions this one is a
ticketlink ("referenced by") and a pull request that mentions it is aweblink ("referenced by pull request"); and up toGITHUB_MAX_LINK_URLSURLs found in the issue body ("mentioned in description"). The timeline is read for at mostGITHUB_MAX_TIMELINE_PAGES_FOR_LINKSpages of 100 events. The sub-issue and timeline lookups are best effort. - History is the issue timeline without comments: label, assignee, title, state and milestone changes, cross-references, commits and reviews. Other events appear with their event name as the field.
- Attachments are not supported (
UNSUPPORTED): files uploaded to an issue are links in its Markdown body.
Rate limits and missing issues
- GitHub signals a rate limit with 403 as well as 429. A 403 that carries
x-ratelimit-remaining: 0or aretry-afterheader is treated as the 429 it means: it is retried after the time the server names, and reported asRATE_LIMITEDwhen retries run out. - 404 hides private repositories; 410 is a deleted issue. Both are reported as
NOT_FOUND. - A repository that was renamed or moved answers with a redirect. It is followed on the same host only.
Limits
| Constant | Value | Meaning |
|---|---|---|
DEFAULT_PAGE_SIZE / MAX_PAGE_SIZE | 50 / 100 | Comments, history entries and search results per page. |
GITHUB_MAX_QUERY_TEXT | 200 | Characters of free text put into a search. |
GITHUB_MAX_REPO_QUALIFIERS | 30 | Repositories named with repo: before a search goes owner-wide. |
GITHUB_SEARCH_CAP | 1000 | Results one search can page through. |
GITHUB_MAX_LINK_URLS | 20 | URLs taken from an issue body for links. |
GITHUB_MAX_TIMELINE_PAGES_FOR_LINKS | 3 | Timeline pages read for cross-references. |
GITHUB_MAX_REPO_PAGES | 5 | Pages of 100 repositories read by listProjects when no repos are configured. |
With repos configured, listProjects answers from the profile without a request. Without them it lists the owner's repositories, leaving out archived ones and those with issues turned off.
Known caveats
The GitHub connectors are the only built-in ones that have been run against the live service, and only with public repositories. See verification status. One item is marked UNVERIFIED in the source:
- GitHub Enterprise Server hosts. The web host is derived from the API URL: an
api.prefix is removed (api.github.com→github.com), otherwise the API host is used as it is, which fits a server that offers the API under/api/v3on the host of its web UI. If your server's web UI is on a different host than this rule gives, pasted issue URLs are not recognised; keys (web-app#412) still work.
See also
- GitHub code host, which reads the pull requests and their closing references to these issues.
- Connectors overview for the rules shared by all connectors.
- Tickets in the SDK.