From 0979e6dc884037d904a3e1dc6aed7b3d07a30bfa Mon Sep 17 00:00:00 2001 From: Aaron Mark Date: Tue, 18 Aug 2026 21:50:48 +0300 Subject: [PATCH] fix: set JFROG_CLI_GHOST_FROG when package alias is enabled Package alias install added PATH shims but never exported the Ghost Frog gate env var, so interception stayed off in later steps. Fixes #343 Signed-off-by: Aaron Mark --- README.md | 2 +- action.yml | 2 +- lib/utils.js | 2 ++ src/utils.ts | 2 ++ test/main.spec.ts | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9cee27460..d00c433fd 100644 --- a/README.md +++ b/README.md @@ -469,7 +469,7 @@ Alternating between configurations can be done by providing the `--server-id` op ### Enabling Package Alias -When enabled, the action runs `jf package-alias install` after setting up JFrog CLI and appends the alias bin directory to `GITHUB_PATH`. Subsequent steps will transparently intercept package manager commands such as `mvn`, `npm`, `go`, etc., so they use JFrog CLI without changing your workflow scripts. +When enabled, the action runs `jf package-alias install` after setting up JFrog CLI, appends the alias bin directory to `GITHUB_PATH`, and exports `JFROG_CLI_GHOST_FROG` so Ghost Frog interception is active. Subsequent steps will transparently intercept package manager commands such as `mvn`, `npm`, `go`, etc., so they use JFrog CLI without changing your workflow scripts. You can optionally provide `package-alias-tools` as a comma-separated list to pass specific package managers to `jf package-alias install --packages`. diff --git a/action.yml b/action.yml index 59ea5824b..8d5ff3611 100644 --- a/action.yml +++ b/action.yml @@ -37,7 +37,7 @@ inputs: description: 'Alias for ghe-base-url' required: false enable-package-alias: - description: "If true, after setting up JFrog CLI the action runs 'jf package-alias install' and appends the alias directory to GITHUB_PATH so that mvn, npm, go, etc. are transparently intercepted in subsequent steps." + description: "If true, after setting up JFrog CLI the action runs 'jf package-alias install', appends the alias directory to GITHUB_PATH, and sets JFROG_CLI_GHOST_FROG so that mvn, npm, go, etc. are transparently intercepted in subsequent steps." default: "false" required: false package-alias-tools: diff --git a/lib/utils.js b/lib/utils.js index 0cb235467..4528a1f25 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -525,6 +525,8 @@ class Utils { } const aliasBinDir = Utils.getPackageAliasBinDir(); core.addPath(aliasBinDir); + // Ghost Frog interception is opt-in; without this env var the PATH shims do not activate. + Utils.exportVariableIfNotSet('JFROG_CLI_GHOST_FROG', 'true'); core.info('Package aliases installed and "' + aliasBinDir + '" added to PATH.'); }); } diff --git a/src/utils.ts b/src/utils.ts index edbdb9e8a..73fc31734 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -593,6 +593,8 @@ export class Utils { } const aliasBinDir = Utils.getPackageAliasBinDir(); core.addPath(aliasBinDir); + // Ghost Frog interception is opt-in; without this env var the PATH shims do not activate. + Utils.exportVariableIfNotSet('JFROG_CLI_GHOST_FROG', 'true'); core.info('Package aliases installed and "' + aliasBinDir + '" added to PATH.'); } } diff --git a/test/main.spec.ts b/test/main.spec.ts index 1923c6933..40972ea13 100644 --- a/test/main.spec.ts +++ b/test/main.spec.ts @@ -622,6 +622,7 @@ describe('setupPackageAliasIfRequested', () => { await Utils.setupPackageAliasIfRequested(); expect(myExec.exec).toHaveBeenCalledWith('jf', ['package-alias', 'install'], { ignoreReturnCode: true }); + expect(myCore.exportVariable).toHaveBeenCalledWith('JFROG_CLI_GHOST_FROG', 'true'); }); it('should pass normalized tools as --packages when package-alias-tools is provided', async () => {