Script Valley
CI/CD with GitHub Actions
Advanced Workflow Patterns/Assessment

Practice & Assessment

Test your understanding of Advanced Workflow Patterns

Multiple Choice Questions

5
1

A composite action has a run step. What additional key is required in that step?

2

What is the correct way to write a step output in modern GitHub Actions?

3

A workflow has concurrency: cancel-in-progress: true. Three pushes happen in rapid succession on the same branch. How many runs execute to completion?

4

What trigger must a reusable workflow define to be callable from other workflows?

5

The paths-ignore filter is set to '**.md'. A commit changes README.md only. What happens to the workflow?

Coding Challenges

1
1

Extract a Setup Composite Action

Refactor an existing workflow that has repeated setup steps (checkout, setup-node, npm ci) appearing in three jobs. Create a composite action at .github/actions/setup-node-app/action.yml that accepts a node-version input (default '20') and performs checkout, setup-node with caching, and npm ci. Replace the repeated steps in all three jobs with a single uses: ./.github/actions/setup-node-app step. Verify: the workflow still runs successfully, the Actions tab shows the composite action expanding into its sub-steps, and total setup time is unchanged. Estimated time: 20 minutes.

Medium

Mini Project

1

Reusable CI/CD Library

Build a GitHub repository that serves as a shared workflow library. Create three reusable workflows: .github/workflows/node-ci.yml (workflow_call with inputs: node-version string, run-lint boolean; runs lint and test jobs), .github/workflows/docker-build.yml (workflow_call with inputs: image-name string; builds and pushes to ghcr.io, uses gha cache), and .github/workflows/deploy-env.yml (workflow_call with inputs: environment string; uses the named environment with url output). Create a composite action at .github/actions/setup-node/action.yml used inside node-ci.yml. In a separate repository (or in the same repo), create a main CI/CD workflow that calls all three reusable workflows in sequence using needs. Add concurrency control at the caller workflow level with cancel-in-progress: true. Add paths-ignore for .md files. Verify the full pipeline runs end-to-end.

Hard