1.1 The “Solar System” Workflow: Before Refactoring
Imagine you have a single workflow handling everything from testing to deploying in both development and production. The deployment steps fordev-deploy and prod-deploy are identical—this is a maintenance headache:
1.2 Review Official Documentation
Before you begin, consult the GitHub Actions guide on reusing workflows. It details supported triggers, inputs, outputs, and known limitations:
See Reusing workflows for all details on
workflow_call triggers and scopes.1.3 Create the Reusable Deployment Workflow
Create a new file.github/workflows/reuse-deployment.yml that declares a workflow_call trigger. Define all required inputs and secrets up front:
Inputs and Secrets
| Name | Description | Required | Type |
|---|---|---|---|
| namespace | Kubernetes namespace | true | string |
| kubeconfig | Kubeconfig file contents | true | string |
| Secret | Description | Required |
|---|---|---|
| KUBECONFIG | Kubernetes kubeconfig secret | true |
Workflow Definition
- Defines required
inputsandsecrets. - Contains a single
reuse-deployjob that checks out the code, configureskubectl, replaces tokens, creates secrets, deploys manifests, and outputs the ingress URL.
1.4 Invoke the Reusable Workflow
In your original workflow file (.github/workflows/solar-system.yml), replace the inline dev-deploy and prod-deploy jobs with calls to the reusable workflow:
Workflow Run Summary
After pushing these changes to a feature branch, the GitHub Actions UI will show the reusable workflow invocations:
reuse-deployment.yml.
Job Names and Statuses
The UI prefixes the reusable-job name underdev-deploy and prod-deploy so you can easily identify the steps executed:

If you forget to pass a required 
input or secret, the job will fail. For example, omitting kubeconfig will cause the Set kubeconfig step to error out:
input and secret listed under on.workflow_call is provided when invoking the reusable workflow.
In the next lesson, we’ll cover advanced patterns for sharing secrets and artifacts across reusable workflows.