Interview Prep/CI/CD/GitHub Actions

What is a workflow_run trigger and when would you use it?

AdvancedConceptGitHub Actions
Answer

workflow_run starts a workflow when another named workflow completes (types: [completed]). It runs in the context of the default branch with access to secrets, which makes it the safe pattern for PR workflows from forks: the untrusted pull_request workflow builds and uploads an artifact with no secrets, and a privileged workflow_run workflow downloads that artifact and posts the comment or deploys.

Treat the downloaded artifact as untrusted input (never execute it or interpolate it into shell).

on:
  workflow_run:
    workflows: ['CI']
    types: [completed]
All CI/CD questions

More on GitHub Actions