Skip to content

Workflow ci gate

github-actions[bot] edited this page Nov 28, 2026 · 4 revisions

ci-gate

What it does. One job, CI green, that is green only when every job it is handed succeeded or was skipped on purpose. Use it when several workflows run side by side (parallel-ci, bash-ci, security, a job of your own) and branch protection should require one result. It holds no token and checks nothing out.

The rule

A job counts only with the result success. skipped counts only for a job named in deliberate-skips, a JSON list of job ids. failure, cancelled, an unknown result, a missing result, no jobs at all and a deliberate skip that names no needed job all fail. A skip nobody asked for, such as everything downstream of a failed build, is a failure.

A security-only repository

security.yml produces no gate, so a repository whose only caller is the security one hands it to this workflow: gate: { if: always(), needs: [security], uses: ...ci-gate.yml@<sha>, permissions: {}, with: { needs-json: ${{ toJSON(needs) }} } }. The check is gate / CI green; require it in branch protection. The weekly audit derives that check from the ci-gate.yml call.

A caller

jobs:
  ci:
    uses: ChiefGyk3D/git-your-ship-together/.github/workflows/parallel-ci.yml@<sha> # vX.Y.Z
    # ...
  shell:
    uses: ChiefGyk3D/git-your-ship-together/.github/workflows/bash-ci.yml@<sha> # vX.Y.Z
    permissions:
      contents: read
      pull-requests: read
  gate:
    if: always()
    needs: [ci, shell]
    uses: ChiefGyk3D/git-your-ship-together/.github/workflows/ci-gate.yml@<sha> # vX.Y.Z
    permissions: {}
    with:
      needs-json: ${{ toJSON(needs) }}

if: always() on the calling job is required: without it the gate is skipped when a job it needs fails, and branch protection reads a skipped required check as passed. The value is read from an environment variable, so pass a small result map when the needed jobs have large outputs.

Inputs (6), read from ci-gate.yml:

Input Type Default Meaning
needs-json string required JSON object of the needed jobs: the toJSON of the needs context, or a map of job id to result such as {"ci": "success"}. Required; an empty object fails. (required)
deliberate-skips string [] JSON list of job ids that may be skipped without failing the gate. Empty by default, so every skip fails it.
egress-policy string block harden-runner egress policy - audit logs outbound connections, block allows only allowed-endpoints. Jobs that hold no secret follow egress-policy-secretless instead (EX-0001); this workflow has none, so the input is only validated.
egress-policy-secretless string block harden-runner egress policy for the gate job, which holds no stored secret, no OIDC token and no write-scoped token - exactly audit or block. Defaults to block since security exception EX-0001 was closed on 2026-11-02; see docs/security/exceptions/. Set audit to opt out if the defect recurs. Any other value fails the job.
allowed-endpoints string api.github.com:443 github.com:443 harden-runner allow-list for block, space-separated host:port entries. The gate reaches nothing; the default is the harden-runner allow-list for the job's own steps (harden-runner and the runner's Actions hosts), unchanged. Wildcards are not supported.
extra-allowed-endpoints string empty Appended to allowed-endpoints. Same format.

Outputs a caller job can read:

Output Meaning
result success or failure, the verdict of the gate.

What it refuses to do

It never passes with nothing to judge, never treats an unknown result as green, and never echoes a job id raw into the log.

Clone this wiki locally