fix: checkout Workflows scripts in reusable-codex-run.yml - #190
Conversation
The reusable workflow was referencing scripts at .github/scripts/ but when running in consumer repos, those scripts don't exist there. Added a sparse checkout of stranske/Workflows to .workflows-lib/ to make the scripts available, and updated the require() paths to use the new location. Fixes: Cannot find module '.github/scripts/post_completion_comment.js'
Automated Status SummaryHead SHA: cb0f1c2
Coverage Overview
Coverage Trend
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
🤖 Keepalive Loop StatusPR #190 | Agent: Codex | Iteration 0/5 Current State
🔍 Failure Classification| Error type | infrastructure | |
There was a problem hiding this comment.
Pull request overview
This PR fixes a module resolution issue in the reusable-codex-run.yml workflow where consumer repos couldn't find the post_completion_comment.js and error_classifier.js scripts because they only exist in the stranske/Workflows repository.
Key Changes
- Added a sparse checkout step for the Workflows repository scripts
- Updated require() paths to reference scripts from the checked-out location
- Enables the workflow to function correctly in consumer repositories
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| with: | ||
| script: | | ||
| const { classifyError, ERROR_CATEGORIES, suggestRecoveryAction } = require('./.github/scripts/error_classifier.js'); | ||
| const { classifyError, ERROR_CATEGORIES, suggestRecoveryAction } = require('./.workflows-lib/.github/scripts/error_classifier.js'); |
There was a problem hiding this comment.
If the path is changed to workflows-lib (to match the convention used in other reusable workflows), this require path should be updated to ./.workflows-lib/.github/scripts/error_classifier.js → ./workflows-lib/.github/scripts/error_classifier.js (without the leading dot before workflows-lib).
Alternatively, consider following the pattern used in reusable-20-pr-meta.yml (lines 124-139) and reusable-18-autofix.yml (lines 234-236) where an environment variable WORKFLOWS_SCRIPTS_PATH is set, and then the require uses that variable: require(\${scriptsPath}/.github/scripts/error_classifier.js`)`.
| ref: main | ||
| sparse-checkout: .github/scripts | ||
| sparse-checkout-cone-mode: false | ||
| path: .workflows-lib |
There was a problem hiding this comment.
The path name .workflows-lib is inconsistent with the naming convention used in other reusable workflows in this repository. Both reusable-20-pr-meta.yml and reusable-18-autofix.yml use workflows-lib (without the leading dot) for the same purpose.
Consider changing the path to workflows-lib to maintain consistency across the codebase. This would also align with the pattern used in lines 115-121 of reusable-20-pr-meta.yml and lines 226-232 of reusable-18-autofix.yml.
| path: .workflows-lib | |
| path: workflows-lib |
| with: | ||
| script: | | ||
| const { postCompletionComment } = require('./.github/scripts/post_completion_comment.js'); | ||
| const { postCompletionComment } = require('./.workflows-lib/.github/scripts/post_completion_comment.js'); |
There was a problem hiding this comment.
If the path is changed to workflows-lib (to match the convention used in other reusable workflows), this require path should be updated to .workflows-lib/.github/scripts/post_completion_comment.js → ./workflows-lib/.github/scripts/post_completion_comment.js (without the leading dot before workflows-lib).
Alternatively, consider following the pattern used in reusable-20-pr-meta.yml (lines 124-139) and reusable-18-autofix.yml (lines 234-236) where an environment variable WORKFLOWS_SCRIPTS_PATH is set, and then the require uses that variable: require(\${scriptsPath}/.github/scripts/post_completion_comment.js`)`.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| repository: stranske/Workflows | ||
| ref: main | ||
| sparse-checkout: .github/scripts | ||
| sparse-checkout-cone-mode: false | ||
| path: .workflows-lib |
There was a problem hiding this comment.
Exclude .workflows-lib checkout from git commits
The new checkout clones stranske/Workflows into .workflows-lib, but the directory is left unignored and undeleted. Later in the same job the Commit and push changes step runs git status --porcelain/git add -A (around lines 413‑450), so even when Codex makes no edits the untracked nested repo makes CHANGED_FILES non‑zero and will be committed and pushed as a gitlink. That means every run now tries to add .workflows-lib to consumer branches, even on no-op runs, polluting repos with an unintended submodule.
Useful? React with 👍 / 👎.
Automated Status Summary
Scope
Tasks
Acceptance criteria
Head SHA: 4f5d0f6
Latest Runs: ⏳ queued — Gate
Required: gate: ⏳ queued