GitHub

Create a GitHub App with the manifest flow (or use one that exists), install it, and opt in to issues, pull requests and projects.

Synaxis reads GitHub (github.com or GitHub Enterprise Server) through a GitHub App. The App reads repositories with short-lived installation tokens, sends webhooks for every push and change, and lets each person link their own GitHub account so Synaxis knows what they may read.

Create the App with the manifest flow

The console asks GitHub to create the App with exactly the permissions, events and webhook Synaxis needs.

  1. Open Connections and select Add a connection.

  2. Under GitHub App, fill in:

    Field Enter
    App name The App's name on GitHub (codewright-synaxis by default; at most 34 characters, unique on GitHub)
    Organization (empty: your own account) The organization that owns the App
    GitHub address https://github.com, or your GitHub Enterprise Server address
    API address https://api.github.com, or your server's API address
  3. Select Create the App on GitHub, then Continue to GitHub.

  4. On GitHub, confirm the App's name and permissions. GitHub sends you back to Synaxis, which stores the App's id, its private key, its webhook secret and its OAuth client as secrets, and adds the connection.

  5. Synaxis then opens GitHub's page for installing the App. Install it on each organization whose repositories Synaxis may read, for all repositories or the ones you choose.

  6. Back in Connections, the new connection syncs. Select Test: it says on how many accounts the App is installed (none means it is not installed yet, and no repository can be listed). Then select Scope to choose its repositories (Scope rules).

Note: Nothing is in scope until a rule includes it. Installing the App on an organization only lets Synaxis list its repositories.

Note: If GitHub cannot reach your server's public address (a server on your own machine or a private network), the console says so, and the App is created without webhooks: the connection checks GitHub for changes every 5 minutes instead (Sync:PollingMinutes). Give the server a public address and turn polling off with Edit to use webhooks later.

The App asks for read access to repository metadata, contents, issues, pull requests and discussions, and to the organization's members and projects. Write access to issues and pull requests is asked only when write-back is on.

Note: If the setup expired or started in another browser, the console says The GitHub App setup expired or did not start here. Start it again. Start again from Add a connection.

Use an App that exists

Create the App on GitHub yourself when you want to choose its settings, or reuse an App you already have. Without webhooks, Synaxis polls instead: it syncs the connection every 5 minutes (Sync:PollingMinutes).

  1. On GitHub, open your organization's Settings → Developer settings → GitHub Apps (or your own account's) and select New GitHub App.
  2. Give it a name and a homepage URL (any, such as your server's address). Under Webhook, clear Active, unless GitHub can reach your server: then set the webhook URL to <public URL>/hooks/github and a webhook secret.
  3. Under Permissions, give Repository permissions: Metadata, Contents, Issues, Pull requests, Discussions, Checks and Actions, each Read-only; and Organization permissions: Members and Projects, each Read-only. Write-back needs Issues and Pull requests as Read and write. With a webhook, subscribe to Check run and Workflow run too, so Synaxis records each commit's checks. When agent tasks may publish, give Checks as Read and write: a task's validation result is then a check run made by the App. Without it, Synaxis publishes a commit status as the task's requester instead (the App created from the console asks for it when agent publication is on).

Note: An App created before Synaxis recorded checks lacks Checks and Actions. Add them on the App's Permissions & events page (and the two events); the organization's owner then accepts the new permissions. Until then, code history shows no checks.

  1. Under Where can this GitHub App be installed?, choose Only on this account, and select Create GitHub App.
  2. On the App's page, note its App ID, then under Private keys select Generate a private key. Your browser downloads a .pem file.
  3. Select Install App and install it on the organization, for all repositories or the ones Synaxis may read.
  4. In the console, open Connections, select Add a connection, and go to An App that already exists. Enter the Name and the App id, select Choose the .pem file (or paste its text under Private key), and keep Poll instead of webhooks on unless you set a webhook (it starts on when you use the console on this machine's own address). With a webhook, enter its Webhook secret. For GitHub Enterprise Server, also give the GitHub address and the API address. Select Add.

Synaxis stores the key and the webhook secret as secrets named after the connection (github/<name>/private-key, github/<name>/webhook-secret); the page never keeps them. If you stored them yourself (synaxis secret set), name them under Use secrets already stored on the server instead.

For people to link their GitHub accounts, give the connection the App's OAuth client id and client secret in the configuration file (clientId, clientSecret; see Configuration as code), and set the App's callback URL to <public URL>/auth/link/github/callback.

The Connections page

Column Shows
State The connection's state, and its last error
Last good sync When a sync last succeeded
Credentials Each stored secret and how long ago it was set, a secret that is not stored, and when a certificate expires
Actions Sync now (queues a sync: "A sync is queued."), Test (signs in to the upstream and says how many accounts the App is installed on, or how many projects Azure DevOps shows), Edit (the name, polling, addresses, sign-in and linking; a new private key or credential replaces the stored one) and Scope

Issues, pull requests and projects

Project data is opt-in per organization and per kind. Set it in the connection's workSources in the configuration file: the organizations whose in-scope repositories' work is read, and issues, pullRequests, discussions, milestones and projects (Projects items with their fields). Comments and descriptions pass the same secret scan as code before they are embedded, and each person sees only items of repositories they can read. Files attached to issues are not read: GitHub offers no API for them, so attachmentText applies to Azure DevOps only.

Rotate the App's private key

  1. Generate a new private key for the App on GitHub.
  2. Store it under the same name: synaxis secret set gh-app-key --from-file new-key.pem.
  3. Delete the old key on GitHub.

See also