SCM Providers
ForgePortal integrates with GitHub and GitLab for repository discovery, file access, and webhooks. You can use one or both. Config lives under scm in forgeportal.yaml; secrets should be set via environment variables.
GitHubβ
Two authentication modes are supported: Personal Access Token (PAT) or GitHub App. App is preferred for production (per-repo permissions, rate limits, webhooks).
Option A: Personal Access Token (PAT)β
- GitHub β Settings β Developer settings β Personal access tokens β Generate new token (classic).
- Scopes: at least repo (full control of private repos). For org repos, ensure the token has access to the organization.
- Set the token in config without putting it in YAML:
- Env:
FORGEPORTAL_SCM__GITHUB__TOKEN=<token> - Or in
forgeportal.yamlonly in secure environments (not recommended):
- Env:
scm:
github:
token: ghp_xxxx
YAML (token from env):
scm:
github: {}
# token provided via FORGEPORTAL_SCM__GITHUB__TOKEN
Option B: GitHub Appβ
- GitHub β Organization or User β Developer settings β GitHub Apps β New GitHub App.
- Set name, URL, webhook URL (see Webhooks below). Permissions:
- Repository permissions: Contents (Read), Metadata (Read), Pull requests (Read/Write if you use PR actions).
- Subscribe to events: e.g. Push, Pull request, Repository.
- Create the App; note App ID. Generate a Private key and save the
.pemfile on the server. - Install the App on the org(s) or repos you use with ForgePortal.
- Configure ForgePortal with App ID and path to the private key:
scm:
github:
appId: "123456"
privateKeyPath: /run/secrets/github-app-key.pem
# webhookSecret: set via env or secret for signature verification
- appId: string (numeric ID of the App).
- privateKeyPath: path to the PEM file (readable by the process).
- Do not set
tokenwhen usingappId+privateKeyPath; the app uses installation tokens automatically.
GitLabβ
GitLab uses a personal or project access token and an optional base URL for self-hosted instances.
Setupβ
- GitLab β User Settings β Access Tokens (or Project/Group β Settings β Access Tokens).
- Create a token with scopes: read_api, read_repository (and write_repository if you need push/PR actions).
- Self-hosted: use your instance URL as
baseUrl. For GitLab.com leavebaseUrlunset or set tohttps://gitlab.com.
YAML:
scm:
gitlab:
# token: set via FORGEPORTAL_SCM__GITLAB__TOKEN
baseUrl: https://gitlab.com
With token via env:
FORGEPORTAL_SCM__GITLAB__TOKEN=<token>
Self-hosted example:
scm:
gitlab:
baseUrl: https://gitlab.mycompany.com
# token via env
Webhooksβ
ForgePortal receives SCM events (push, PR, etc.) on a single endpoint and verifies signatures using a shared secret. You configure the webhook in the SCM (GitHub/GitLab) and the same secret in ForgePortal.
Endpointβ
| Method | URL |
|---|---|
| POST | https://<forgeportal-host>/api/v1/webhooks/scm |
Use HTTPS in production. For local dev you can use a tunnel (e.g. ngrok) and point the SCM webhook to it.
Secretβ
Set the same value in:
- ForgePortal
- GitHub:
scm.github.webhookSecret(orFORGEPORTAL_SCM__GITHUB__WEBHOOK_SECRET). - GitLab:
scm.gitlab.webhookSecret(orFORGEPORTAL_SCM__GITLAB__WEBHOOK_SECRET).
- GitHub:
- GitHub (Settings β Webhooks β Add webhook β Secret).
- GitLab (Project/Group β Settings β Webhooks β Secret token).
Generate a random string (e.g. openssl rand -hex 32) and never commit it.
GitHub: events to sendβ
- Push events (required for catalog/discovery updates).
- Pull request (if you use PR-based flows).
- Repository (optional; creation/deletion).
In GitHub Webhook settings, choose βLet me select individual eventsβ and enable at least Push.
GitLab: triggerβ
- Push events
- Merge request events (if you use MR-based flows)
Enable the needed checkboxes in the GitLab webhook form.
Behaviorβ
- ForgePortal validates the payload using the providerβs signature (e.g. GitHub
X-Hub-Signature-256, GitLabX-Gitlab-Tokenor signature header, depending on implementation). - Invalid or missing secret β 401/403.
- Valid events are processed for catalog updates and any registered actions.
Summaryβ
| Provider | Auth | Config keys | Env override (example) |
|---|---|---|---|
| GitHub (PAT) | Token | scm.github.token | FORGEPORTAL_SCM__GITHUB__TOKEN |
| GitHub (App) | App ID + PEM path | scm.github.appId, scm.github.privateKeyPath | β |
| GitHub webhook | Secret | scm.github.webhookSecret | FORGEPORTAL_SCM__GITHUB__WEBHOOK_SECRET |
| GitLab | Token | scm.gitlab.token, scm.gitlab.baseUrl | FORGEPORTAL_SCM__GITLAB__TOKEN |
| GitLab webhook | Secret | scm.gitlab.webhookSecret | FORGEPORTAL_SCM__GITLAB__WEBHOOK_SECRET |
For all config keys and types, see forgeportal.yaml β scm. For legacy or generic env var names, see Environment Variables.