Skip to content

Fix bootstrap.js crash from premature @actions/core static import#144

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-github-actions-workflow-another-one
Closed

Fix bootstrap.js crash from premature @actions/core static import#144
Copilot wants to merge 2 commits intomainfrom
copilot/fix-github-actions-workflow-another-one

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

All four bootstrap.js files gained a top-level import * as core from '@actions/core' to enable richer error logging. Since node_modules is installed at runtime (via npm ci), Node.js fails to resolve this ESM static import before any bootstrap logic runs, crashing the action immediately.

Changes

  • Dynamic import instead of static: Replace import * as core from '@actions/core' with const core = await import('@actions/core') as the first statement in the finally block, where node_modules is guaranteed to exist
  • npm ci failure path: console.error is used here since @actions/core is unavailable when installation itself fails; core.setFailed() is preserved for the npm run build failure path where node_modules is present
  • Formatting: Applied consistent style from the originating PR ({spawn}, single-param arrow functions, trailing commas)
// Before — crashes on load when node_modules doesn't exist
import * as core from '@actions/core'

// After — deferred until node_modules is confirmed present
} finally {
  const core = await import('@actions/core')
  // core.setFailed / core.info now safe to call
Original prompt

Fix the failing GitHub Actions workflow Test (sites/site-with-errors)
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 64748466050
Job URL: https://github.com/github/accessibility-scanner/actions/runs/22370677159/job/64748466050


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Root cause: PR #143 added `import * as core from '@actions/core'` as a
top-level static import. Since node_modules isn't pre-installed, Node.js
fails to resolve this import before any code (including npm ci) runs.

Fix: Replace the static top-level import with a dynamic import inside
the `finally` block where node_modules is guaranteed to exist. For the
npm ci failure case, use console.error since @actions/core isn't
available yet.

Co-authored-by: JoyceZhu <6251669+JoyceZhu@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions workflow Test (sites/site-with-errors) Fix bootstrap.js crash from premature @actions/core static import Feb 24, 2026
@JoyceZhu JoyceZhu closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants