Reusable workflow call shape
jobs:
build:
uses: ./.github/workflows/reusable-build.yml
with:
runtime: '22'- A local reusable workflow can establish a shared build contract.
- Inputs should be typed and documented in the called workflow.
Reduce pipeline duplication, pin external dependencies deliberately and troubleshoot from run context before rerunning blindly.
Reusable workflows can centralize common build or deployment contracts. Keep interfaces explicit so callers know required inputs, outputs, secrets and permissions.
Third-party and even first-party actions execute code in the workflow. GitHub's secure-use guidance recommends pinning actions to a full-length commit SHA for immutable references when strong supply-chain control is required.
Check the event payload, job permissions, runner environment, resolved inputs, logs and artifact state. A rerun without understanding can reproduce or conceal the same fault.
jobs:
build:
uses: ./.github/workflows/reusable-build.yml
with:
runtime: '22'Goal: Create one build script invoked by two service pipelines and prove behavior changes in one place.
mkdir -p ~/gnu-cicd-labs/module11/{service-a,service-b} && cd ~/gnu-cicd-labs/module11
cat > reusable-build.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
service="$1"
test -f "$service/source.txt"
mkdir -p "$service/dist"
tr '[:lower:]' '[:upper:]' < "$service/source.txt" > "$service/dist/app.txt"
EOF
chmod +x reusable-build.shprintf 'alpha\n' > service-a/source.txt
printf 'beta\n' > service-b/source.txt./reusable-build.sh service-a
./reusable-build.sh service-bgrep -q ALPHA service-a/dist/app.txt && grep -q BETA service-b/dist/app.txtPlatform teams use reusable workflow contracts to standardize builds and deployments while letting application repositories retain clear inputs.
Open each answer only after you have tried to answer the question yourself.
Its inputs, outputs, required secrets/permissions and expected behavior.
It gives an immutable action reference and reduces risk from a movable tag being changed.
The trigger/event, inputs, permissions, runner context, logs and artifacts associated with the failure.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.