Schedule icon
Script icon
Docker icon
If icon
RunWorkflow icon
Fail icon
OutputValues icon

GitHub Actions Evidence-Gated Deployment

Gate GitHub deployments on live CI results, successful required jobs, current branch commit, and non-expired artifacts.

Categories
Infrastructure

Prevent deployment unless a specific GitHub Actions run has completed successfully, required jobs passed, release artifacts exist, and its commit still matches the branch head. Evidence is retrieved live from GitHub.

How it works

  1. Run manually with repository, run ID, required job names and artifacts. A disabled Schedule illustrates recurring use but needs a real run ID source.
  2. collect_evidence calls the GitHub REST API, paginates jobs/artifacts, verifies the run belongs to the repository, checks CI conclusions, and rejects stale branches or missing/nonempty artifacts.
  3. evidence_gate rejects failed or incomplete evidence and preserves JSON.
  4. On approval, dispatch_choice either records a read-only verdict or dispatches a reviewed deployment workflow with expected_sha and evidence_run_id inputs. Dispatch requires explicit SHA-guard acknowledgment.

What you get

  • evidence.json with run SHA, branch, checked jobs and artifacts, and explicit failure reasons.
  • A fail-closed gate: missing checks, expired artifacts or moved branches cannot trigger deployment.
  • Optional actual GitHub Actions workflow_dispatch, never simulated.
  • SHA-bound dispatch contract: a reviewed downstream workflow must reject SHA mismatches and check out the exact verified commit.

Who it's for

Platform engineers, release managers and DevOps teams controlling CI/CD.

Why orchestrate this with Kestra

Kestra retains run-specific audit artifacts and enforces the deployment dependency in an If branch, rather than relying on a dashboard or alert.

Prerequisites

  • Kestra 2.0, Python Script and GitHub plugins, Docker-capable worker.
  • GitHub repository, completed Actions run with uploaded artifacts, and deployment workflow configured for workflow_dispatch.
  • An access token with Actions read access and, if dispatching, Actions write.
  • For dispatch, a trusted deploy workflow declaring required workflow_dispatch inputs expected_sha and evidence_run_id; it must fail before deployment if its triggering github.sha differs from expected_sha, and check out expected_sha instead of an unpinned branch.
  • Inputs must reference the exact repository, run ID, job display names, artifact names and deploy workflow file.

Secrets

  • GITHUB_TOKEN: GitHub access token used for live API reads and deployment dispatch. Store as a Kestra secret, not in source.

Quick start

  1. Save GITHUB_TOKEN; configure repository, run ID, required jobs/artifacts.
  2. Execute with dispatch_deployment false. Inspect evidence.json and verdict.
  3. Test a missing artifact: execution fails without dispatch.
  4. To dispatch, audit the deploy workflow's SHA guard first. Set sha_guard_confirmed and dispatch_deployment true only after verifying the workflow declares expected_sha and evidence_run_id inputs, rejects mismatched github.sha, and checks out the exact expected_sha. If the branch moves between evidence validation and dispatch, the downstream workflow must reject the dispatch without deploying.

Required downstream workflow contract

The target GitHub Actions workflow must declare workflow_dispatch inputs expected_sha and evidence_run_id. Every deployment path must run only if github.sha equals inputs.expected_sha, and actions/checkout must use ref: ${{ inputs.expected_sha }}. Use a required verification job and make each deployment job depend on it; don't let other jobs bypass the guard. sha_guard_confirmed is an operator attestation, not a remotely enforced inspection of workflow code. This blueprint dispatches only; it doesn't wait for or certify the downstream deployment result.

How to extend

  • Add a GitHub webhook to pass a completed run ID instead of manual input.
  • Bind job checks to branch rulesets and attestations; add approvals.
  • Verify immutable artifact digests before production deployment.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.