Skip to content

Comments

Add more error logging to Actions#143

Open
JoyceZhu wants to merge 5 commits intomainfrom
joyce/add_more_error_logging_to_Actions
Open

Add more error logging to Actions#143
JoyceZhu wants to merge 5 commits intomainfrom
joyce/add_more_error_logging_to_Actions

Conversation

@JoyceZhu
Copy link
Contributor

Looks like we need to explicitly call
core.setFailed before process.exit(1) (aka
what we use if anything goes wrong) if we want
this to be human-readable in Actions logs.

Looks like we need to explicitly call
`core.setFailed` before `process.exit(1)` (aka
what we use if anything goes wrong) if we want
this to be readable in Actions logs.
Copilot AI review requested due to automatic review settings February 24, 2026 21:18
@JoyceZhu JoyceZhu requested a review from a team as a code owner February 24, 2026 21:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances error logging in GitHub Actions bootstrap files by adding core.setFailed() calls before process.exit(1) to ensure error messages are human-readable in Actions logs. It also includes code formatting improvements (removing spaces in destructuring imports, using arrow functions without parentheses for single parameters, and removing trailing newlines).

Changes:

  • Added core.setFailed() calls before process.exit(1) in error handlers for npm ci and build failures
  • Added informational logging with core.info() when starting the main action script
  • Applied consistent code formatting across all bootstrap files

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
.github/actions/fix/bootstrap.js Added core.setFailed() for npm ci and build errors, added info logging, applied formatting updates
.github/actions/find/bootstrap.js Added error logging for npm ci and build errors, added info logging, applied formatting updates (but uses console.error instead of core.setFailed)
.github/actions/file/bootstrap.js Added core.setFailed() for npm ci and build errors, added info logging, applied formatting updates
.github/actions/auth/bootstrap.js Added core.setFailed() for npm ci and build errors, added info logging, applied formatting updates
Comments suppressed due to low confidence (1)

.github/actions/find/bootstrap.js:55

  • This should use core.setFailed() instead of console.error() for consistency with the other three bootstrap files (fix, file, and auth) and to properly mark the action as failed in GitHub Actions logs. The PR description specifically mentions the need to call core.setFailed before process.exit(1) for human-readable error messages in Actions logs.
      console.error(`npm run build (TypeScript compilation) failed: ${error}`)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

})
} catch {
} catch (error) {
console.error(`npm ci failed: ${error}`)
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

This should use core.setFailed() instead of console.error() for consistency with the other three bootstrap files (fix, file, and auth) and to properly mark the action as failed in GitHub Actions logs. The PR description specifically mentions the need to call core.setFailed before process.exit(1) for human-readable error messages in Actions logs.

This issue also appears on line 55 of the same file.

Copilot uses AI. Check for mistakes.
Copilot AI added a commit that referenced this pull request Feb 24, 2026
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>
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.

1 participant