Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 50 additions & 4 deletions .github/workflows/smoke-codex.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions scripts/ci/postprocess-smoke-workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const workflowPaths = [
// - "Install awf binary" or "Install AWF binary" step at any indent level
// - run command invoking install_awf_binary.sh with a version
const installStepRegex =
/^(\s*)- name: Install [Aa][Ww][Ff] binary\n\1\s*run: bash \/opt\/gh-aw\/actions\/install_awf_binary\.sh v[0-9.]+\n/m;
/^(\s*)- name: Install [Aa][Ww][Ff] binary\n\1\s*run: bash (?:\/opt\/gh-aw|\$\{RUNNER_TEMP\}\/gh-aw)\/actions\/install_awf_binary\.sh v[0-9.]+\n/m;
const installStepRegexGlobal = new RegExp(installStepRegex.source, 'gm');

function buildLocalInstallSteps(indent: string): string {
Expand Down Expand Up @@ -102,18 +102,12 @@ for (const workflowPath of workflowPaths) {
// Replace "Install awf binary" step with local build steps
const matches = content.match(installStepRegexGlobal);
if (matches) {
if (matches.length !== 1) {
throw new Error(
`Expected exactly one awf install step in ${workflowPath}, found ${matches.length}. ` +
'Ensure the workflow has a single "Install awf binary" step in the agent job.'
);
}
content = content.replace(
installStepRegexGlobal,
(_match, indent: string) => buildLocalInstallSteps(indent)
);
modified = true;
console.log(` Replaced awf install step with local build`);
console.log(` Replaced ${matches.length} awf install step(s) with local build`);
Comment on lines 102 to +110
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping the matches.length !== 1 guard means this will blindly replace every matching install step, even in jobs that don’t have a repo checkout / Node toolchain. In this PR it results in smoke-codex.lock.yml’s detection job getting npm ci/npm run build without any actions/checkout. Consider reintroducing validation per-match (e.g., ensure the surrounding job contains a checkout step) and/or teach buildLocalInstallSteps injection to also add a checkout step when needed, so the postprocess script can’t generate broken workflows.

See below for a potential fix:

    if (matches.length === 1) {
      content = content.replace(
        installStepRegexGlobal,
        (_match, indent: string) => buildLocalInstallSteps(indent)
      );
      modified = true;
      console.log(`  Replaced ${matches.length} awf install step(s) with local build`);
    } else {
      console.warn(
        `  Skipping awf install step replacement: expected exactly 1 match, found ${matches.length}`
      );
    }

Copilot uses AI. Check for mistakes.
}

// Remove sparse-checkout from agent job checkout (need full repo for npm build)
Expand Down
Loading