Interview Prep/GitHub Actions/Custom Actions & Reusable Workflows

How do you declare inputs, secrets and outputs in a reusable workflow?

IntermediateConceptCustom Actions & Reusable Workflows
Answer
on:
  workflow_call:
    inputs:
      environment: { type: string, required: true }
      replicas: { type: number, default: 2 }
      dry-run: { type: boolean, default: false }
    secrets:
      SLACK_WEBHOOK: { required: false }
    outputs:
      url:
        description: Deployed URL
        value: ${{ jobs.deploy.outputs.url }}
jobs:
  deploy:
    runs-on: ubuntu-24.04
    outputs:
      url: ${{ steps.out.outputs.url }}

Input types are string, number and boolean only. Outputs must be mapped from job outputs via the jobs context.

All GitHub Actions questions Roadmap: GitHub Actions

More on Custom Actions & Reusable Workflows