CICD-223 · Workflow chaining
Encyclopedia · Advanced workflow orchestration · All snippets
Previous · CICD-222 · Next · CICD-224
1. Where it fits
- Placement At workflow scope in the downstream workflow file.
- Prerequisites authenticated GitHub CLI, approved target repositories, or Actions runner for YAML entries.
- Platforms github-actions.
2. Copy the snippet
yaml
on:
workflow_run:
workflows: ["Trusted build"]
types: [completed]
branches: [main]3. How it works
workflow_run subscribes to completion of a separate workflow instead of adding a needs edge. Gate on the trusted upstream conclusion and verify evidence independently.
The upstream completion signal admits a separately declared workflow.
flowchart TD
N1["Trusted build"]
N2["Completed event"]
N1 --> N2
N3{"Upstream conclusion successful"}
N2 --> N3
N4["Verify selected evidence"]
N3 -->|Yes| N4
N5["Skip release"]
N3 -->|No| N5
classDef trigger fill:#EFF6FF,stroke:#0540F2,color:#0A0A0A
classDef build fill:#CCFBF1,stroke:#0D9488,color:#0A0A0A
classDef test fill:#EEF2FF,stroke:#4F46E5,color:#0A0A0A
classDef gate fill:#FEF3C7,stroke:#D97706,color:#0A0A0A
classDef security fill:#EDE9FE,stroke:#7C3AED,color:#0A0A0A
classDef deploy fill:#D1FAE5,stroke:#059669,color:#0A0A0A
classDef fail fill:#FEE2E2,stroke:#DC2626,color:#0A0A0A
class N1 build
class N2 trigger
class N3 gate
class N4 security
class N5 fail
4. Verify the result
Add a job condition for github.event.workflow_run.conclusion == 'success'. Restrict the upstream workflow to trusted main commits and verify artifact provenance separately.
Watch for. Place event filters at workflow scope and test an event that should run and an event that should be skipped.
Validation version-dependent (YAML parse). Status definitions.