Interview Prep/GitHub Actions/Reuse at Scale: Reusable Workflows & Actions

You want to ensure only the central deploy workflow can assume the production AWS role, not arbitrary workflows in app repos. How?

AdvancedScenarioReuse at Scale: Reusable Workflows & Actions
Answer

Situation read → Default sub identifies the repo and environment, not the workflow file.

What I'd do →

  1. Customize the OIDC subject template for the org or repos to include job_workflow_ref:
    gh api -X PUT orgs/devopsshack/actions/oidc/customization/sub \
      --input - <<< '{"include_claim_keys":["repo","context","job_workflow_ref"]}'
    
  2. Trust policy StringLike on sub to repo:devopsshack/*:environment:prod:job_workflow_ref:devopsshack/platform-workflows/.github/workflows/deploy-eks.yml@refs/tags/v*.
  3. Keep the platform-workflows repo protected (CODEOWNERS, tag rulesets).

Why → App teams can call the deploy workflow but cannot write their own job that assumes the prod role.

Interview tip → This is an advanced answer; few candidates know job_workflow_ref.

All GitHub Actions questions Roadmap: GitHub Actions

More on Reuse at Scale: Reusable Workflows & Actions