GitHub integration

Connect GitHub repositories to automatically deploy functions when you push code. fold.run supports both GitHub OAuth for login and GitHub App connections for auto-deploy.

GitHub OAuth login

Sign in with your GitHub account instead of email and password.

From the dashboard

Click "Continue with GitHub" on the login page at app.fold.run/console/login. This redirects to GitHub for authorization, then back to the dashboard.

If you are a new user, an organization is automatically created from your GitHub username.

From the API

Exchange a GitHub OAuth code for a JWT:

curl -X POST https://api.fold.run/auth/github/exchange \
  -H "Content-Type: application/json" \
  -d '{ "code": "github_oauth_code_here" }'

Response:

{
  "token": "eyJhbGciOiJIUzI1NiJ9...",
  "user": { "id": "usr_abc", "email": "you@example.com" },
  "is_new_user": false
}

If you have two-factor authentication enabled, the response returns an mfa_token instead of a full JWT.

Auto-deploy from GitHub

Connect a repository so that pushing code automatically deploys your function.

curl -X POST https://api.fold.run/github-app/connections \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "repo_full_name": "your-org/your-repo",
    "branch": "main",
    "function_id": "fn_abc123",
    "path": "src/worker.ts",
    "auto_deploy": true
  }'
Field Type Required Description
repo_full_name string Yes GitHub repo in owner/repo format
branch string Yes Branch to watch for pushes
function_id string Yes Function to deploy on push
path string No File path in the repo (defaults to {function-name}.ts)
auto_deploy boolean No Enable automatic deploys on push (default: true)

How auto-deploy works

  1. You push a commit to the configured branch.
  2. GitHub sends a webhook to the platform.
  3. The platform fetches the configured file from the repository.
  4. If the file exists, a new version is deployed automatically.

The deploy is recorded with github:{author-name} as the deployer, so you can track who triggered each version.

List connections

curl https://api.fold.run/github-app/connections \
  -H "Authorization: Bearer YOUR_TOKEN"

Returns all connections for your organization, including last_deploy_at and last_commit_sha.

Remove a connection

curl -X DELETE https://api.fold.run/github-app/connections/ghconn_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN"

Removing a connection stops auto-deploy but does not affect the deployed function.

Disabling auto-deploy

Set auto_deploy to false when creating or updating a connection. The connection still tracks commits but will not trigger deploys. This is useful for staging branches where you want manual control.