A repository allows Copilot coding agent to open draft pull requests for issue assignments. The team wants a validation workflow that captures failure evidence when tests fail, uploads diagnostic artifacts, and still fails the required check so maintainers cannot merge broken agent output. Which option completes the workflow?
name: validate-agent-pr
on:
pull_request:
branches:
- main
permissions:
contents: read
pull-requests: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run test suite
id: tests
(Missing value 1): |
mkdir -p diagnostics
npm ci
npm test 2>&1 | tee diagnostics/test-output.txt
- name: Upload diagnostics
if: (Missing value 2)
uses: actions/upload-artifact@v4
with:
name: agent-pr-diagnostics-${{ github.event.pull_request.number }}
path: diagnostics/
if-no-files-found: error
- name: Preserve failed check result
if: steps.tests.outcome == 'failure'
(Missing value 3): exit 1Choose an answer
Tap an option to check your answer.
Correct answer: Missing value 1 = run Missing value 2 = failure() Missing value 3 = run.
Why this is the answer
The correct option completes the workflow to ensure diagnostic artifacts are uploaded on test failure and the check fails. For "Missing value 1", run is the correct keyword to execute shell commands, such as mkdir, npm ci, and npm test. uses is for calling actions, not shell commands. For "Missing value 2", failure() is the correct expression to ensure the "Upload diagnostics" step runs only when the previous "Run test suite" step fails. This captures failure evidence as required. success() would only run on success, always() would run regardless of outcome (which is less specific than needed), and cancelled() is for a cancelled job. For "Missing value 3", run is used to execute the exit 1 command, which explicitly fails the step and, consequently, the job, preventing the pull request from being merged. with is for providing inputs to an action, and env is for setting environment variables.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed