A maintainer wants to manually invoke the repository’s agent workflow from the terminal. The workflow file exists on main, but the maintainer tests this command from a feature branch that also modifies .github/workflows/invoke-agent.yml. Which change should the maintainer make before using this as the standard invocation pattern? Select one answer.
git checkout feature/agent-runner-changes
gh workflow run invoke-agent.yml \
--ref feature/agent-runner-changes \
-f issue_number=284 \
-f run_mode=implement \
-f create_draft_pr=false
gh run watchChoose an answer
Tap an option to check your answer.
Correct answer: Run the reviewed workflow from main.
Why this is the answer
The maintainer is trying to run a workflow from a feature branch that modifies the workflow file itself. This is problematic because the gh workflow run command, when used with --ref, will execute the version of the workflow file present on that specific branch. If the feature branch's workflow has unreviewed or incomplete changes, running it could lead to unexpected behavior, errors, or security vulnerabilities. For a standard invocation pattern, especially for a maintainer, it's crucial to use a stable, reviewed, and merged version of the workflow. Therefore, running the workflow from the main branch ensures that the executed code is the officially accepted and tested version. Replacing workflowdispatch with schedule would change how the workflow is triggered (from manual to time-based) and wouldn't address the issue of running unreviewed code. Removing all workflow inputs would make the workflow less flexible and wouldn't solve the problem of running a potentially unstable workflow. Using pullrequesttarget is for workflows triggered by pull requests targeting a specific branch, not for manual invocation from the terminal, and it also doesn't guarantee reviewed code execution.
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