GitHub App Setup Documentation
This guide will walk you through the steps to create and configure a GitHub App for your integration needs.
๐ Prerequisites
- A GitHub account with access to the organization or repositories where the app will be installed.
- Admin permissions for the organization if the app is organization-wide.
๐ ๏ธ Step 1: Create the GitHub App
- Go to GitHub Developer Settings (replace
{OrgName}with your actual organization name). - Click on "New GitHub App".
- Fill in the required fields:
- GitHub App name: Choose a unique and descriptive name. (e.g.,
EasyHosting App) - Homepage URL: (e.g.,
https://{SLUG}.easyhosting.strongminds.dev). - User authorization callback URL: Leave blank.
- Under Webhook, uncheck the Active checkbox.
- Under Permissions, add
- Repository permissions
- Actions = Read and write
- Administration = Read and write
- Contents = Read and write
- Environments = Read and write
- Secrets = Read and write
- Workflows = Read and write
- Select Where can this GitHub App be installed?
-
Only on this account
-
Click Create GitHub App.
- Note down App Id (To be used in step 4)
๐ Step 2: Generate App Credentials
After creation:
- Generate a private key:
- Click Generate a private key.
- Download and securely store the
.pemfile. (To be used in step 4) - App ID and Client ID:
- Youโll find these on the app settings page.
- Client secret:
- Click Generate a new client secret.
- Store it securely.
๐ง Step 3: Install the App
- Go to your GitHub App settings.
- Click Install App.
- Choose to install on your user or organization account.
- Select the repositories to install it on, or grant access to all.
- Note down the installation id from the url
https://github.com/organizations/{ORG}/settings/installations/{INSTALLATION_ID}(To be used in step 4)
Step 3.5: Configure Bypass Rules (if branch protection is enabled)
If your organisation uses a branch ruleset that requires pull requests before merging into the default branch (e.g. main), EasyHosting's GitHub App must be granted bypass access so it can commit CI/CD configuration files directly to that branch.
How to check: Go to your organisation settings โ Code security โ Rulesets. If a ruleset targets the default branch and includes the "Require a pull request before merging" rule, you must follow the steps below.
Add the GitHub App to the bypass list
- Go to Organisation Settings โ Code security โ Rulesets.
- Click on the ruleset that protects your default branch (e.g.
mainormaster). - Under Bypass list, click + Add bypass.
- Select GitHub Apps as the actor type.
- Search for your app by the name you chose in Step 1 (e.g.
EasyHosting App). - Set the bypass mode to Always allow.
- Save the ruleset.
Why "Always allow"? EasyHosting pushes commits directly to the default branch when deploying services. The "Allow for pull requests only" mode is not sufficient โ it only permits creating and merging PRs, not direct pushes.
Note: You need the App ID from Step 1 to identify your app if multiple apps are listed during the search.
Note: If your repository also has a classic Branch protection rule (not a ruleset) on the default branch, ensure the "Do not allow bypassing the above settings" checkbox is deselected. If it is enabled, it overrides all bypass lists and prevents EasyHosting from pushing directly to the branch.
Step 3.6: Enable deploy keys for your organisation
When you add a GitHub repository under Code repositories, EasyHosting provisions a write deploy key named easyhosting-deploy-key and stores its private key as the WRITE_DEPLOY_KEY repository secret. This also happens if adding a service creates the code repository for the first time. Adding another service to an existing code repository does not replace the key, and deleting the last service leaves the key in place.
The generated workflow uses this key to push the digest-pinned deployment manifest and release catalog record while honoring the repository's configured deploy-key bypass. If your organisation's deploy keys policy is disabled, provisioning fails with an error similar to:
Could not create deploy key in repository {repo}: Validation Failed (HTTP 422) [PublicKey custom Deploy keys are disabled for this repository]
Enable the policy
- Go to Organisation Settings โ Policies โ Deploy keys.
- Select Enabled.
- Click Save.
๐ป Step 4: Use the App in EasyHosting
- Navigate to your EasyHosting instance
- Goto Credentials
- Goto Code repository
- Add credential
- Add URL
https://github.com/{ORG} - Credential Type: Github App
- Insert the app id from the Github App
- Insert the installation id you noted down
- Insert the private key you generated in step 2
- Add repository credential
The credential authorizes EasyHosting to access GitHub. Adding it does not create a deploy key; the key is created when the GitHub repository is added under Code repositories.
Repair a deploy key
If the deploy key or WRITE_DEPLOY_KEY secret is missing or no longer works:
- Check that the repository credential is valid and the GitHub App has the permissions described above. Correct any deploy-key policy or branch-rule issues first.
- Open Code repositories and select the affected repository.
- Open its More options dropdown and select Refresh deploy key. This action requires WRITE access in EasyHosting and is available for GitHub Git repositories.
- Wait for the success notification, then rerun the failed workflow if needed. Refreshing the key does not rerun a build or deployment.
Refresh creates a replacement key, updates WRITE_DEPLOY_KEY, and then removes the previous EasyHosting-managed key. Other deploy keys are left alone. If refresh fails, the error notification shows the problem; correct it and retry.
If adding a code repository reports that it was saved but its key could not be provisioned, open that repository's detail page and use the same refresh action. Existing repositories are not automatically rotated after an EasyHosting upgrade.
Deleting a code repository attempts to remove its managed key and secret. EasyHosting blocks deletion while a service uses the repository. Missing credentials or GitHub cleanup failures can leave these resources behind.
๐ Resources
๐งน Best Practices
- Keep your private key secure and rotate it periodically.
- Limit permissions to only what's necessary.