@@ -403,7 +403,7 @@ function toolVersion(version, githubAuth) {
403403 return __awaiter(this, void 0, void 0, function* () {
404404 core.debug('=== Check tool version');
405405 if (version === 'latest') {
406- const res = yield client.getJson('https://api.github.com/repos/clojure/brew-install/releases/latest', githubAuth ? { Authorization: githubAuth } : undefined );
406+ const res = yield client.getJson('https://api.github.com/repos/clojure/brew-install/releases/latest', { Authorization: githubAuth });
407407 const versionString = (_a = res.result) === null || _a === void 0 ? void 0 : _a.tag_name;
408408 if (versionString) {
409409 return versionString;
@@ -427,7 +427,9 @@ function getUrls(tag, githubAuth) {
427427 var _a;
428428 return __awaiter(this, void 0, void 0, function* () {
429429 core.debug('=== Get download URLs');
430- const res = yield client.getJson(`https://api.github.com/repos/clojure/brew-install/releases/tags/${tag}`, githubAuth ? { Authorization: githubAuth } : undefined);
430+ const res = yield client.getJson(`https://api.github.com/repos/clojure/brew-install/releases/tags/${tag}`, {
431+ Authorization: githubAuth
432+ });
431433 const posix_install_url = `https://github.com/clojure/brew-install/releases/download/${tag}/posix-install.sh`;
432434 const assets = (_a = res.result) === null || _a === void 0 ? void 0 : _a.assets;
433435 if (assets && isResourceProvided(posix_install_url, assets)) {
@@ -445,10 +447,10 @@ function getUrls(tag, githubAuth) {
445447 }
446448 });
447449}
448- function setup(requestedVersion, githubToken ) {
450+ function setup(requestedVersion, githubAuth ) {
449451 return __awaiter(this, void 0, void 0, function* () {
450452 core.debug('=== Run setup');
451- const version = yield toolVersion(requestedVersion, githubToken );
453+ const version = yield toolVersion(requestedVersion, githubAuth );
452454 const installDir = utils.isWindows()
453455 ? 'C:\\Program Files\\WindowsPowerShell\\Modules'
454456 : '/tmp/usr/local/opt';
@@ -461,7 +463,7 @@ function setup(requestedVersion, githubToken) {
461463 });
462464 }
463465 else {
464- const { linux, posix, windows } = yield getUrls(version, githubToken );
466+ const { linux, posix, windows } = yield getUrls(version, githubAuth );
465467 if (utils.isWindows()) {
466468 yield exec.exec(`powershell -c "iwr -useb ${windows} | iex"`, [], {
467469 // Install to a modules location common to powershell/pwsh
@@ -475,15 +477,15 @@ function setup(requestedVersion, githubToken) {
475477 let clojureInstallScript;
476478 if (utils.isMacOS()) {
477479 if (posix) {
478- clojureInstallScript = yield tc.downloadTool(posix, undefined, githubToken );
480+ clojureInstallScript = yield tc.downloadTool(posix, undefined, githubAuth );
479481 }
480482 else {
481- clojureInstallScript = yield tc.downloadTool(linux, undefined, githubToken );
482- yield MacOSDeps(clojureInstallScript, githubToken );
483+ clojureInstallScript = yield tc.downloadTool(linux, undefined, githubAuth );
484+ yield MacOSDeps(clojureInstallScript, githubAuth );
483485 }
484486 }
485487 else {
486- clojureInstallScript = yield tc.downloadTool(linux, undefined, githubToken );
488+ clojureInstallScript = yield tc.downloadTool(linux, undefined, githubAuth );
487489 }
488490 const clojureToolsDir = yield runLinuxInstall(clojureInstallScript, path.join(installDir, 'ClojureTools'));
489491 core.debug(`clojure tools deps installed to ${clojureToolsDir}`);
@@ -506,23 +508,26 @@ function runLinuxInstall(installScript, destinationFolder) {
506508 return destinationFolder;
507509 });
508510}
509- function MacOSDeps(file, githubToken ) {
511+ function MacOSDeps(file, githubAuth ) {
510512 return __awaiter(this, void 0, void 0, function* () {
511513 core.debug('=== Install extra deps for MacOS');
512514 const data = yield fs.readFile(file, 'utf-8');
513515 const newValue = data.replace(/install -D/gim, '$(brew --prefix coreutils)/bin/ginstall -D');
514516 yield fs.writeFile(file, newValue, 'utf-8');
515- const env = githubToken
516- ? { env: { HOMEBREW_GITHUB_API_TOKEN: githubToken.substring(7) } }
517- : undefined;
518- yield exec.exec('brew', ['install', 'coreutils'], env);
517+ yield exec.exec('brew', ['install', 'coreutils'], {
518+ env: {
519+ HOMEBREW_GITHUB_API_TOKEN: githubAuth.substring(7),
520+ HOMEBREW_NO_INSTALL_CLEANUP: 'true',
521+ HOME: process.env['HOME'] || ''
522+ }
523+ });
519524 });
520525}
521526function getLatestDepsClj(githubAuth) {
522527 var _a, _b;
523528 return __awaiter(this, void 0, void 0, function* () {
524529 core.debug('=== Fetch latest version of deps clj');
525- const res = yield client.getJson(`https://api.github.com/repos/borkdude/deps.clj/releases/latest`, githubAuth ? { Authorization: githubAuth } : undefined );
530+ const res = yield client.getJson(`https://api.github.com/repos/borkdude/deps.clj/releases/latest`, { Authorization: githubAuth });
526531 const result = (_b = (_a = res.result) === null || _a === void 0 ? void 0 : _a.tag_name) === null || _b === void 0 ? void 0 : _b.replace(/^v/, '');
527532 if (result) {
528533 return result;
@@ -898,8 +903,8 @@ function main() {
898903 try {
899904 const { LEIN_VERSION, BOOT_VERSION, TDEPS_VERSION, CLI_VERSION, BB_VERSION, CLJ_KONDO_VERSION, CLJFMT_VERSION, CLJSTYLE_VERSION, ZPRINT_VERSION } = getTools();
900905 const tools = [];
901- const githubToken = core.getInput('github-token');
902- const githubAuth = githubToken ? `Bearer ${githubToken}` : undefined ;
906+ const githubToken = core.getInput('github-token', { required: true } );
907+ const githubAuth = `Bearer ${githubToken}`;
903908 const IS_WINDOWS = utils.isWindows();
904909 if (LEIN_VERSION) {
905910 tools.push(lein.setup(LEIN_VERSION, githubAuth));
@@ -908,10 +913,10 @@ function main() {
908913 tools.push(boot.setup(BOOT_VERSION, githubAuth));
909914 }
910915 if (CLI_VERSION) {
911- tools.push(cli.setup(CLI_VERSION));
916+ tools.push(cli.setup(CLI_VERSION, githubAuth ));
912917 }
913918 if (TDEPS_VERSION && !CLI_VERSION) {
914- tools.push(cli.setup(TDEPS_VERSION));
919+ tools.push(cli.setup(TDEPS_VERSION, githubAuth ));
915920 }
916921 if (BB_VERSION) {
917922 tools.push(bb.setup(BB_VERSION, githubAuth));
@@ -1327,7 +1332,7 @@ exports.isMacOS = isMacOS;
13271332
13281333Object.defineProperty(exports, "__esModule", ({ value: true }));
13291334exports.VERSION = void 0;
1330- exports.VERSION = '12-4 ';
1335+ exports.VERSION = '12-5 ';
13311336
13321337
13331338/***/ }),
0 commit comments