Skip to content

Commit e77f9e0

Browse files
fix: use VITEST env guard instead of NODE_ENV to prevent silent breakage in customer workflows
Co-Authored-By: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com>
1 parent bb02f2f commit e77f9e0

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

dist/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39743,8 +39743,10 @@ async function createPR(octokit, owner, repo, branchName, targetBranch, isFromFe
3974339743
core.info(`Pull request created: ${prResponse.data.html_url}`);
3974439744
return prResponse;
3974539745
}
39746-
// Auto-invoke only when running as the action entry point (not when imported in tests)
39747-
if (process.env.NODE_ENV !== "test") {
39746+
// Auto-invoke only when running as the action entry point (not when imported in tests).
39747+
// Vitest sets VITEST=true automatically; NODE_ENV is not used because a customer's
39748+
// workflow could set NODE_ENV=test and silently prevent run() from executing.
39749+
if (!process.env.VITEST) {
3974839750
run();
3974939751
}
3975039752

src/sync.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,9 @@ async function createPR(
665665
return prResponse;
666666
}
667667

668-
// Auto-invoke only when running as the action entry point (not when imported in tests)
669-
if (process.env.NODE_ENV !== "test") {
668+
// Auto-invoke only when running as the action entry point (not when imported in tests).
669+
// Vitest sets VITEST=true automatically; NODE_ENV is not used because a customer's
670+
// workflow could set NODE_ENV=test and silently prevent run() from executing.
671+
if (!process.env.VITEST) {
670672
run();
671673
}

0 commit comments

Comments
 (0)