Multi-Job Workflow with Artifact Handoff
Anthropic ☯️ Medium CI/CD
Beginner Mode

Start your terminal to use beginner mode.

Objective

A repository at /home/interview/repo has a Node.js application with a test suite. The team needs a two-stage pipeline where the first job runs tests and the second job creates a summary report from those results. The repository has upload-artifact and download-artifact actions available locally at .github/actions/.

Task

Complete the workflow at .github/workflows/artifact-handoff.yml that triggers on pull_request events using container images (node:20-slim). Job A (test-job) should check out code, run ./run-tests.sh, and upload test-results.txt as an artifact named test-results. Job B (report-job) should depend on Job A using needs, download the test-results artifact, count passed tests with grep -c "PASS:", save the count to summary.txt as "Total Passed Tests: X", and upload it as a test-summary artifact.

File Path

  • Workflow: /home/interview/repo/.github/workflows/artifact-handoff.yml
  • Test suite: /home/interview/repo/run-tests.sh

Terminal requires a larger screen

Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.

Linux Terminal Environment

Write and execute your solution in the terminal below.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →