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.
More on Custom Actions & Reusable Workflows
What are the three kinds of custom action and how do you choose?BeginnerWrite a minimal composite action that installs Node and dependencies with caching.IntermediateWhat can a composite action not do compared to a job?IntermediateHow do you pass outputs out of a composite action?IntermediateWhat does `action.yml` contain for a JavaScript action?IntermediateWhy must a JavaScript action commit its `dist/` or `node_modules`?Intermediate