Skip to content

Commit

Permalink
move commandExists to the top.
Browse files Browse the repository at this point in the history
  • Loading branch information
n-g committed Sep 6, 2023
1 parent 26fb59d commit 5086af4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 32 deletions.
32 changes: 16 additions & 16 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6959,22 +6959,22 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume

function run() {
return __awaiter(this, void 0, void 0, function* () {
yield _actions_core__WEBPACK_IMPORTED_MODULE_0__.group(`Prepare access to Namespace`, () => __awaiter(this, void 0, void 0, function* () {
var commandExists = __nccwpck_require__(1569);
yield commandExists("nsc")
.then(function () {
_actions_core__WEBPACK_IMPORTED_MODULE_0__.info(`Namespace Cloud CLI found.`);
})
.catch(function () {
try {
installNsc();
}
catch (e) {
_actions_core__WEBPACK_IMPORTED_MODULE_0__.setFailed(e.message);
}
});
yield _actions_exec__WEBPACK_IMPORTED_MODULE_2__.exec("nsc version");
}));
var commandExists = __nccwpck_require__(1569);
commandExists("nsc")
.then(function () {
_actions_core__WEBPACK_IMPORTED_MODULE_0__.info(`Namespace Cloud CLI found.`);
})
.catch(function () {
try {
_actions_core__WEBPACK_IMPORTED_MODULE_0__.group(`Prepare access to Namespace`, () => __awaiter(this, void 0, void 0, function* () {
yield installNsc();
yield _actions_exec__WEBPACK_IMPORTED_MODULE_2__.exec("nsc version");
}));
}
catch (e) {
_actions_core__WEBPACK_IMPORTED_MODULE_0__.setFailed(e.message);
}
});
const registry = yield _actions_core__WEBPACK_IMPORTED_MODULE_0__.group(`Log into Namespace workspace`, () => __awaiter(this, void 0, void 0, function* () {
yield ensureNscloudToken();
return yield dockerLogin();
Expand Down
31 changes: 15 additions & 16 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@ import * as fs from "fs";
import * as path from "path";

async function run(): Promise<void> {
await core.group(`Prepare access to Namespace`, async () => {
var commandExists = require("command-exists");
await commandExists("nsc")
.then(function () {
core.info(`Namespace Cloud CLI found.`);
})
.catch(function () {
try {
installNsc();
} catch (e) {
core.setFailed(e.message);
}
});

await exec.exec("nsc version");
});
var commandExists = require("command-exists");
commandExists("nsc")
.then(function () {
core.info(`Namespace Cloud CLI found.`);
})
.catch(function () {
try {
core.group(`Prepare access to Namespace`, async () => {
await installNsc();
await exec.exec("nsc version");
});
} catch (e) {
core.setFailed(e.message);
}
});

const registry = await core.group(`Log into Namespace workspace`, async () => {
await ensureNscloudToken();
Expand Down

0 comments on commit 5086af4

Please sign in to comment.