1. Connect a GitHub account
An admin or owner of the org does this once per GitHub account:- Open the org in the panel, then the Git tab.
- Click Install GitHub App. GitHub asks which account (your user or a GitHub organization) and which repositories the platform may access, and asks you to authorize the app.
- GitHub sends you back to the Git tab, where the account is now listed.
2. Link a project
Open the project’s Settings tab and find Git repository:
Linking and unlinking need the Admin role. Your own GitHub account must also be able to access the repository
through the installation: the first time you link (and again after an hour), the panel asks you to Authorize on
GitHub, which returns you to the project. The platform keeps that authorization, encrypted, for at most an hour and only
uses it to check which repositories you may link.
A repository can be linked to several projects, for example one per root directory of a monorepo.
Unlink stops reacting to pushes and pull requests and removes the project’s open previews. Production
deployments stay as they are. Deleting the project removes the link too.
What deploys when
The platform downloads the exact commit from GitHub, keeps only the root directory, and deploys it like an upload with
atoll deploy, including the same size limit. Symlinks are kept when they point inside the root directory (such as a
shared gradlew); others are left out. The deployment records the branch, commit, commit message (the pull request
title for previews) and pull request number. Git deployments have no “created by” user.
Only the newest commit deploys. Right before it starts a deployment, the platform checks that the commit is still the head of
the production branch (or of the open pull request). When you push twice in a row, the first push is skipped if the
second one already arrived, so an older commit never replaces a newer one in production.
Pull requests from forks
Code from a fork hasn’t been reviewed, so the platform doesn’t build it on its own. The commit gets a pending status explaining that a maintainer can add the labelatoll-preview to the pull request. Only people with write access
to the repository can add labels, so adding it is the approval.
The label approves the commit that is the pull request’s head when it is added. When the fork pushes more commits,
they wait again: remove the label and add it once more to build them. Labels on closed pull requests do nothing.
Previews from forks never get secret env vars; non-secret ones are passed as usual.
Feedback on GitHub
Every commit the platform deploys gets a commit status namedatoll/<project>:
Details on the status opens the project’s deployments in the panel.
Pull requests also get one comment per project with the preview’s status and URLs. The platform updates that comment in
place as new commits deploy, and notes when the preview is removed.
Keeping links up to date
The platform follows changes on GitHub on its own:- A renamed or transferred repository keeps its links.
- When the app loses access to a repository, or the repository is deleted, projects linked to it are unlinked and their open previews removed.
- When the app is uninstalled, every connection and link through it is removed. A suspended installation is shown as suspended and deploys nothing until it is unsuspended.
- Deleting an org removes its connections.
- Closing a pull request removes its previews even if the project was linked to another repository meanwhile. Statuses and comments always go to the repository a deployment came from.
For operators: create the GitHub App
Git integration is off until the server has a GitHub App. Without one, the git routes answer 404 and the panel shows the Git tab as off.- On GitHub, open Settings → Developer settings → GitHub Apps → New GitHub App (under a GitHub organization’s settings to own it there).
-
Fill in:
The API host is
ATOLL_PUBLIC_URL, where/apiis served. - Repository permissions: Contents read-only, Metadata read-only, Pull requests read and write, Commit statuses read and write. Organization permissions: Members read-only, so the platform can check that the user connecting an installation owns the GitHub organization.
- Subscribe to events: Push, Pull request, Repository. Installation and installation repositories events are always sent to apps.
- Choose whether other accounts may install the app (Any account for a public install).
-
Create the app, then generate a private key (a
.pemfile) and a client secret.
The server refuses to start when only some of them are set. With the Helm chart, put the secrets in the secret named
by
features.git.existingSecret and the rest under features.git.config.
The server needs outbound HTTPS to the API URL, the web URL and codeload.github.com (where source downloads are
redirected). Webhook deliveries are checked against X-Hub-Signature-256, and each delivery is handled once. When
part of a delivery fails because GitHub couldn’t be reached (the commit gets an error status), redeliver it from the
app’s Advanced settings on GitHub: only the projects that failed are retried.