Repository navigation
Description
Context
Reported in #27670. When jobs.pre_activation.pre-steps or jobs.activation.pre-steps are set, injected pre-steps get spliced inside the auto-generated Setup Scripts step instead of after it, producing invalid YAML with duplicate uses:/with: keys that fails actionlint and GitHub Actions at runtime.
Root Cause
In pkg/workflow/compiler_jobs.go, insertPreStepsAfterSetupBeforeCheckout uses the regex (?m)^\s*id:\s*setup\s*$ to find the splice point, then sets insertIdx = lastSetupIdx + 1.
However, generateSetupStep in pkg/workflow/compiler_yaml_step_generation.go emits the Setup Scripts step as multiple separate []string entries (one per YAML line):
- index N:
- name: Setup Scripts\n - index N+1:
id: setup\n← regex matches here - index N+2:
uses: ...\n← splice happens here, mid-step
This splits the step's YAML block in half.
Objective
Fix the splice-point logic so pre-steps are inserted after the complete Setup Scripts step.
Approach
Choose Option A (preferred) from the issue:
- Detect the end of the
Setup Scriptsstep by finding the next entry that starts a new step (begins with-at the same indentation level), and use that index as the splice point — rather thanlastSetupIdx + 1.
Alternatively:
- Emit the
Setup Scriptsstep as a single[]stringentry containing the full multi-line YAML block.
Files to Modify
pkg/workflow/compiler_jobs.go— fixinsertPreStepsAfterSetupBeforeCheckoutsplice logicpkg/workflow/compiler_yaml_step_generation.go— (if taking single-entry approach) adjustgenerateSetupSteppkg/workflow/compiler_jobs_test.go— add regression tests
Acceptance Criteria
- A workflow with
jobs.pre_activation.pre-stepscontaining auses:-style step compiles to valid YAML - A workflow with
jobs.activation.pre-stepscontaining arun:-style step compiles to valid YAML - The generated
.lock.ymlpassesactionlint - Pre-steps appear after the full
Setup Scriptsstep and before the firstactions/checkout@*step - Regression tests added for both
pre_activationandactivationwithuses:andrun:pre-steps -
make agent-finishpasses
Related to on.github-app credentials cannot be sourced from a custom job's outputs (jobs.{pre_activation,activation}.pre-steps splicing/needs bugs + missing on.needs API) #27670
Generated by Plan Command for issue #27670 · ● 242.8K · ◷
- expires on Apr 24, 2026, 2:47 AM UTC
Activity
github-actions commentedon Apr 22, 2026
🍪 *Issue Monster selected this for Copilotecho BEGIN___COMMAND_OUTPUT_MARKER ; PS1= ; PS2= ; unset HISTFILE ; EC=0 ; echo ___BEGIN___COMMAND_DONE_MARKER___0 ; }
I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.
If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.
Om nom nom! 🍪
Caution
Security scanning requires review for Issue Monster
Details
Potential security threats were detected in the agent output. The workflow output should be reviewed before merging.
Review the workflow run logs for details.