HCode builds a project from one branch of a GitHub repository. Install the HCode GitHub App to deploy private repositories and to deploy on every push. A public repository can also be deployed from its address alone.
Connect GitHub
You can connect from the New project page or from your account:
- Click Connect GitHub on the New project page, or install app under Connected accounts on your account page. GitHub opens in a new tab.
- Install the app on your GitHub account or organisation, and give it the repositories HCode should deploy.
- Back in HCode, click Verify connection. GitHub confirms which installations are yours, and your repositories appear.
Connected accounts then shows the accounts the app is installed on and how many repositories it can reach. Its configure link opens GitHub's installation settings, where you add or remove repositories.
If something goes wrong on the way back from GitHub, the page says what happened. The common ones:
| Message | What to do |
|---|---|
| "GitHub shows no installation of the app for your account yet." | Install the app on GitHub, then verify again |
| "GitHub authorization was cancelled." | Verify again when you are ready |
| "That GitHub connection link has expired or was already used." | Start connecting again from the same page |
| "This GitHub installation is already connected to another account." | Contact [email protected] if it should be yours |
Private and public repositories
With the app installed, pick any repository it can reach. A private repository needs the app; without access, a pasted address is refused with "We couldn't find this repository. Check the URL; if it's private, connect GitHub and grant access."
A public repository works without the app: paste its address under Or enter a public repository URL. HCode then fetches it without signing in, and pushes to it don't start deploys unless the app is installed on that repository too.
Only GitHub is supported. Any other address gets "This is not a link to a GitHub repository. Use the form https://github.com/owner/repo."
Deploys on push
With the app installed on the repository, every push to a project's branch starts a deploy of that project. Every project built from the same repository and branch deploys, and the match is on the exact repository, so a push to acme/app never deploys acme/app-two. There is no setting to turn this off.
When pushes come in quickly, the newest wins:
- A push of the commit that is already deploying, with no settings change, is skipped.
- A deploy that is still queued or building is cancelled and replaced by the newer one.
- A deploy whose build has finished and whose image is being saved or rolled out is allowed to finish, and the new one waits behind it.
A project you connected by public address picks up the app's installation on its first push, as long as someone in your organisation can use the repository through it.
Keep repository access
Before any deploy that fetches code through the app, HCode checks that at least one person in the organisation can still use the repository on GitHub. That person needs the owner, admin or member role and a verified GitHub connection. This covers manual deploys, pushes and API deploys. Rollback, start, stop and restart don't fetch code, so they aren't checked.
If nobody has access any more, for example after the only person with access left the GitHub organisation, deploys pause:
- A manual deploy is refused with "Reconnect GitHub — nobody in this organization still has access to this repository."
- Pushes are skipped.
- The project page shows "Reconnect GitHub to keep deploying this project" and confirms that the running service keeps running.
To fix it, someone who can reach the repository on GitHub chooses Reconnect GitHub on the project page. If HCode reports "GitHub didn't give your account access to this repository", install the app on the GitHub account or organisation that owns the repository, give it the repository, then click Reconnect GitHub again. When it works, the page says "GitHub is reconnected".
Viewers can't reconnect GitHub; the banner asks them to find an owner, admin or member who can.
Change the repository or branch
Change Repository URL or Branch under Settings, in Build configuration. HCode checks a new repository when you save. A branch the repository doesn't have is refused with a message naming its default branch, and a repository it can't reach is refused with "we cannot access this repository. if it is private, grant the hcode GitHub App access to it on GitHub, then save again." Deploy afterwards to build from the new source.
A deploy of a branch that has since been deleted or renamed fails with "This repository has no branch" and the branch name. See Build failures.