GitHub workflows
The GitHub Actions pipeline is defined in .github/workflows/ and .github/actions/setup-toolchain/.
It is the counterpart of the Bitbucket pipeline and runs the same npm scripts. Every
toolchain job uses the pinned salesforce/cli:<version>-full container over a full clone, installs
with the pinned npx -y npm@11.19.0 ci --prefer-offline --no-audit --ignore-scripts line (the
reasons are in the codebase and the CLI),
and links only the SF CLI plugins it needs via npm run ci:install:tools -- --only <plugin>.
Which parts belong to the repository and which are shared:
- The trigger workflows (
push-*.yml,pull-request.yml) are the per-repository part: they carry the branch names and environment names. - The reusable workflows (
_*.yml) and the composite action are shared with the template.
For adopting these files in a repository, see Wire a repository into GitHub Actions.
Conventions
| Topic | Behaviour |
|---|---|
| Runtime | actions/checkout with fetch-depth: 0 so delta base refs and tags resolve. The container runs as root over a runner-owned workspace, so each job that checks out registers $GITHUB_WORKSPACE as a git safe.directory. |
| Install | The composite action setup-toolchain restores the npm cache, runs the install line and links the plugins; checkout precedes it because a local action is loaded from the workspace. The npx fetch of npm is the only registry fetch at pipeline time. |
| Permissions | Every job declares permissions: with contents: read. statuses: write is added where the quick-deploy validation id is published as a commit status. contents: write is added for the write-back workflows (sync-content, code-analyzer-baseline). Callers of reusable workflows grant the same permissions and pass secrets: inherit. |
| Variables, secrets | Repository variables and secrets reach the toolchain as the job env CI_VARIABLES: ${{ toJSON(vars) }} and CI_SECRETS: ${{ toJSON(secrets) }}, hydrated by utils/env.mjs. DEPLOYMENT_ENVIRONMENT carries the environment input. See environment variables. |
| Pinning | Actions are pinned by full commit SHA with the version as a comment. The secret scan runs in the official gitleaks image pinned by digest (Alpine with bash and git; the runner supplies node). |
| Artifacts | actions/upload-artifact with one name per job (validate, validate-org, validate-scratch, deploy, pool-<tag>-<batch>, pool-cleanup) and if-no-files-found: ignore. |
| Test results | JUnit results are rendered into the job summary by npm run ci:github:test:summary; GitHub has no Tests tab. |
| Manual steps | None: a run never waits for a button. The merge into main releases, and deploy-production.yml re-deploys a given sha on demand. |
Reusable workflows
Reusable workflows are declared once with workflow_call and referenced from the triggers below.
| Workflow | Inputs | Runs | Purpose | timeout-minutes |
|---|---|---|---|---|
_scan-secrets.yml |
log-opts, fetch-ref |
gitleaks git --config=.gitleaks.toml --log-opts=<log-opts> --redact --verbose . in the gitleaks image; git fetch of fetch-ref first when set |
Secret gate: fails on a credential in any commit in the scanned range. No npm ci. |
default |
_validate.yml |
— | setup-toolchain with code-analyzer, Java 17 JRE install, npm run validate under a UTF-8 locale, ci:github:test:summary |
Static gate: build, format:check, lint (code-analyzer), tests. No org involved. Artifact validate. |
120 |
_validate-against-scratch.yml |
— | gate scratch-validation-gate.mjs → ci:auth:devhub, create:scratch … --use-pool, conditional test apex, ci:github:test:summary, ci:teardown |
Deploys the PR metadata into a claimed pool scratch org. Two jobs: a bare gate job runs scratch-validation-gate.mjs without npm ci; the validation job needs it and is skipped, and shown as skipped in the checks, when the gate prints false. Installs inline instead of via setup-toolchain. Artifact validate-scratch. |
105 |
_validate-against-org.yml |
environment, delta-from |
ci:auth:deploy [--environment <environment>], deploy:validate --wait 40 [--delta-from <delta-from>], ci:github:test:summary |
Check-only deploy against the real stage org; the validation id is published as a commit status. An empty environment is derived from the branch by the toolchain. Artifact validate-org. |
120 |
_deploy-to-org.yml |
environment (required) |
ci:auth:deploy, ci:auth:devhub, deploy --wait 40, ci:github:test:summary |
The real deploy. Quick-deploys from the published validation id, else delta, else full. Artifact deploy. |
120 |
_maintain-pool.yml |
pool-tag (required), batch |
ci:auth:devhub, org:pool:prepare --devhubusername devhub --tag <pool-tag> --debug |
Tops a pool up toward maxAllocation in batches. batch only distinguishes artifact names (pool-<tag>-<batch>). |
115 |
_validate-against-org.yml and _deploy-to-org.yml run git fetch origin "+refs/heads/*:refs/remotes/origin/*" || true
so delta and baseline refs resolve on the runner; _validate-against-scratch.yml and
_maintain-pool.yml run it for the pool's initialization baseline. Delta deploys apply only where a
DELTA_DEPLOY_<NAME> repository variable opts the stage in; scratch validation is opt-in per stage
through SCRATCH_ORG_VALIDATION_<STAGE>, with DISABLE_SCRATCH_ORG_VALIDATION=true as the global
kill switch.
Triggers
graph TD
push["Push to any other branch"] --> V1["Validate"]
prOpen["Pull request (any source)"] --> SS["Scan Secrets"] --> VS["Validate against Scratch"] --> VO["Validate against Org"]
dev["Push to develop"] --> depSIT["Validate → Deploy to SIT (auto)"]
uat["Push to uat/test"] --> depUAT["Validate → Deploy to UAT (auto)"]
main["Push to main/master/trunk"] --> depProd["Validate → Validate vs LIVE → Deploy to Production (all auto)"]
| Trigger workflow | Event | Jobs |
|---|---|---|
push-feature.yml |
push, branches-ignore: develop, uat, test, main, master, trunk |
Validate |
pull-request.yml |
pull_request |
Scan Secrets → Validate against Scratch → Validate against Org |
push-develop.yml |
push to develop |
Validate → Deploy to SIT (environment: sit) |
push-uat.yml |
push to uat, test |
Validate → Deploy to UAT (environment: uat) |
push-main.yml |
push to main, master, trunk |
Validate → Validate against LIVE → Deploy to Production (environment: production) |
Jobs within a workflow run sequentially through needs. Concurrency differs per workflow:
| Workflow | Concurrency group | cancel-in-progress |
|---|---|---|
push-feature.yml |
validate-${{ github.ref }} |
true |
pull-request.yml |
pr-<pull request number> |
false |
push-develop.yml |
develop |
false |
push-uat.yml |
uat |
false |
push-main.yml |
main |
false |
Only push-feature.yml cancels superseded runs; every workflow that touches an org keeps the run.
push-main.yml has no manual step: the merge into main releases (see
the branch, environment and org model),
and the pull request into main is where production is validated (pull-request.yml passes no
environment; the toolchain maps the target branch). Pull requests must be merged with merge
commits (see quick deploy).
Operator workflows
Triggered manually or on a schedule from the GitHub UI. Scheduled workflows cannot receive inputs.
| Workflow | Event and inputs | What it does |
|---|---|---|
deploy-production.yml |
workflow_dispatch; sha (required) |
Re-deploy tool. Runs only from main; fails unless sha (at least 7 characters) is a prefix of the current main HEAD, then calls _deploy-to-org.yml with environment: production. Concurrency group main, no cancellation. |
pool-maintenance.yml |
schedule weekdays 05:30 Europe/Berlin; workflow_dispatch with pool-tag choice all / ci / dev |
Matrix of pool × batch (1, 2) over _maintain-pool.yml. Scheduled runs and all cover both ci and dev; otherwise only the chosen pool. fail-fast: false. |
pool-cleanup.yml |
workflow_dispatch; pool-tag choice ci / dev |
org:pool:cleanup --devhubusername devhub --tag <pool-tag> --debug — deletes pool orgs wholesale. Artifact pool-cleanup. |
sync-content.yml |
workflow_dispatch; org-name choice sit / uat / production, metadata choice emailTemplates |
ci:auth:deploy --environment <org-name>, ci:auth:gitbot, ci:sync --target-org <org-name> --metadata <metadata>. Retrieves the selected metadata from an org into the branch. Needs contents: write. |
code-analyzer-baseline.yml |
schedule Mondays 03:00 Europe/Berlin; workflow_dispatch with branch (default develop) |
Regenerates the suppression baseline (lint:createbaseline), commits it with [skip ci] and pushes it back. Scheduled workflows run on the default branch, so the job checks out branch explicitly. The push uses the workflow token (which triggers no other workflow) unless BASE64_BOT_PRIVATE_KEY is set, then SSH with the bot key. Needs contents: write. |
audit-dependencies.yml |
pull_request with paths package.json, package-lock.json, .npmrc; schedule daily 06:00 Europe/Berlin; workflow_dispatch |
ci:audit:node:dependencies: blocks on malware advisories only. The daily run reports advisories published after a lockfile merged; a green run is silent. |
scan-secrets-history.yml |
workflow_dispatch |
_scan-secrets.yml over the whole history of the selected ref (--log-opts=--full-history HEAD). Same image and rules as the PR scan. |
Scheduled workflows receive no inputs, so pool-maintenance.yml derives the pool list from the
event: a schedule runs every pool.
For the deploy behaviour behind the deploy and validate jobs, see delta deployments and quick deploys.