Skip to content

GitHub Integration

Rack Gateway integrates with GitHub to verify commits and (optionally) post PR comments when deploy approval requests are created.

  • Commit verification against a branch
  • PR detection for the branch being deployed
  • Optional PR comments when a request is created
  • Branch policy controls (default branch restrictions)
Terminal window
# GitHub personal access token or app installation token
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx

The token needs permissions to read branches/commits and post PR comments:

PermissionScopePurpose
repoReadVerify commits and branches
issuesWritePost PR comments
  1. Go to GitHub Settings → Developer settings → Personal access tokens
  2. Generate a token with repo and issues:write
  3. Store it as GITHUB_TOKEN

These settings live under Apps → {app} → Settings:

SettingDescriptionExample
vcs_providerMust be githubgithub
vcs_repoRepository in owner/repo formatMyOrg/myapp
github_verificationEnable commit verificationtrue
verify_git_commit_modebranch or latestlatest
require_pr_for_branchRequire an open PRtrue
default_branchDefault branch namemain
allow_deploy_from_default_branchAllow deploys from default branchfalse
github_post_pr_commentPost PR comment on request creationtrue
Terminal window
# Environment variable configuration
RGW_APP_MYAPP_SETTING_VCS_PROVIDER=github
RGW_APP_MYAPP_SETTING_VCS_REPO=MyOrg/myapp
RGW_APP_MYAPP_SETTING_GITHUB_VERIFICATION=true
RGW_APP_MYAPP_SETTING_VERIFY_GIT_COMMIT_MODE=latest
RGW_APP_MYAPP_SETTING_REQUIRE_PR_FOR_BRANCH=true
RGW_APP_MYAPP_SETTING_DEFAULT_BRANCH=main
RGW_APP_MYAPP_SETTING_ALLOW_DEPLOY_FROM_DEFAULT_BRANCH=false
RGW_APP_MYAPP_SETTING_GITHUB_POST_PR_COMMENT=true

When a deploy approval request is created, the gateway verifies the commit:

  • latest: commit must equal branch HEAD
  • branch: commit must exist somewhere in branch history

If verification fails, the request is rejected.

When GitHub verification is enabled, the gateway attempts to find an open PR for the branch. If found, the PR URL is stored and shown in the approval UI.

If github_post_pr_comment is enabled, the gateway posts a comment when the request is created. The comment includes a link to the approval request.

  • Ensure GITHUB_TOKEN is set and has access to the repo
  • Verify vcs_repo matches owner/repo
  • Check Audit Logs for GitHub verification failures