Skip to content

GitHub App setup

Install CodeHawk App, the public App owned by bts-io. Its slug is codehawk-app, its bot is codehawk-app[bot], and its App ID is 5882014. Choose Only select repositories and select the repositories that will run Code Hawk.

Permission Level Jobs and reason
Contents Write Fix publication creates a branch and commits. Static scans, PR reviews and replies read repository context.
Pull requests Write Static scans, dependency scans, PR reviews, replies, browser flows and fix publication post reports or open PRs.
Issues Write Weekly review files and closes summary issues. Fix publication posts replies. PR reviews and replies request read access.
Workflows Write The automatic setup pull request adds workflow files. No review, scan or fix job receives it.
Deployments Read Preview preparation and reporting in the preview-flows reusable workflow.
Metadata Read GitHub includes repository metadata access with installation tokens for all App jobs.

Subscribed webhook events are installation and installation_repositories only. No other webhook events are subscribed. Any later change to these permissions or events needs every installer to accept it.

Actions read and checks read are being removed from the App registration by its owner. They are not available in Worker slices.

Workflows write is used only by automatic installation setup, which adds the workflow file needed to run Code Hawk. Installations queue setup pull requests in the background. If GitHub refuses workflow creation, the pull request includes settings and the workflow text to copy by hand. The token Worker's exchange allowlist excludes workflows, so review, scan and fix jobs cannot obtain it through that endpoint.

For the public App, the private key stays in the token Worker. Jobs request only their permission slice by sending a GitHub Actions OIDC token and an explicit permissions object to POST /v1/token. The job needs id-token: write. The Worker checks the requested keys and levels against its allowlist and scopes the issued token to the signed repository ID. See permissions by job.

The reusable workflows call the Worker through actions/token. Each token-minting job and its calling job need id-token: write. Install the CodeHawk App on the calling repository. No App ID or private key is needed for the hosted path. The token_worker_url workflow input selects another Worker when needed.

You can register your own GitHub App instead. Open Settings → Developer settings → GitHub Apps → New GitHub App, give it a unique name and homepage, and disable the webhook if you only use the reusable workflows. Actions supplies their events. Enable the permissions needed by your jobs from the table above. Workflows write is only needed for the setup pull request.

Install your App on selected repositories. Put its generated PEM private key in the CODEHAWK_PRIVATE_KEY Actions secret and pass its numeric ID through the app_id workflow input. You can store that ID in the CODEHAWK_APP_ID Actions variable. These credentials belong to your own App. A private key selects the self-hosted path and requires an App ID. An App ID without a key is ignored with a notice. Rotate the key without committing it.

The hosted related-context route reads consent from each related repository's default branch. Your own App key instead scopes access through your installation, without using the hosted consent route.

Add these lines to the caller's existing with and secrets maps when opting in:

with:
app_id: ${{ vars.CODEHAWK_APP_ID }}
secrets:
CODEHAWK_PRIVATE_KEY: ${{ secrets.CODEHAWK_PRIVATE_KEY }}

If minting fails, check that the App ID and key belong to the same App, its installation includes the repository, and permission changes have been accepted.

For the public App, register these callback URLs exactly:

https://codehawk.app/setup/api/callback
https://codehawk-site.borderlesstechnologysolutions.workers.dev/setup/api/callback

The first is the setup page's address. The second keeps sign-in working for anyone who still opens the page on its old address.

Enable Expire user authorization tokens. Leave Request user authorization (OAuth) during installation and Enable Device Flow off. The setup page starts authorization when the user chooses to sign in. It uses state and S256 PKCE, discards refresh tokens and ends sessions within an hour. The client ID is Iv23li7SXnTdj2R2zXPY. Keep the client secret in the token Worker's CODEHAWK_APP_CLIENT_SECRET secret, with the matching repository secret for CI.

The token Worker's SETUP_ORIGINS lists both addresses, https://codehawk.app first.