Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,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`.

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ class Utils {
}
/**
* If enable-package-alias is true and GITHUB_PATH is set, runs `jf package-alias install`
* and appends the alias bin directory to GITHUB_PATH so subsequent steps intercept mvn, npm, go, etc.
* and adds the alias bin directory to PATH via core.addPath so subsequent steps intercept mvn, npm, go, etc.
* On failure (e.g. older CLI without package-alias), logs a warning and does not fail the job.
*/
static setupPackageAliasIfRequested() {
Expand Down Expand Up @@ -513,8 +513,10 @@ class Utils {
return;
}
const aliasBinDir = Utils.getPackageAliasBinDir();
(0, fs_1.appendFileSync)(githubPath, aliasBinDir + '\n');
core.info('Package aliases installed and "' + aliasBinDir + '" appended to GITHUB_PATH.');
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.');
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,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.');
}
}
1 change: 1 addition & 0 deletions test/main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,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 () => {
Expand Down
Loading