Skip to content

Commit

Permalink
auth: set NSC_TOKEN_FILE env var if token file exist
Browse files Browse the repository at this point in the history
  • Loading branch information
edganiukov committed Apr 6, 2023
1 parent 51b8703 commit e2efa3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6847,10 +6847,9 @@ function getDownloadURL() {
}
function ensureNscloudToken() {
return __awaiter(this, void 0, void 0, function* () {
const tokenSpecFile = "/var/run/nsc/token.spec";
if (fs__WEBPACK_IMPORTED_MODULE_3__.existsSync(tokenSpecFile)) {
const tokenSpec = fs__WEBPACK_IMPORTED_MODULE_3__.readFileSync(tokenSpecFile, "utf8");
_actions_core__WEBPACK_IMPORTED_MODULE_0__.exportVariable("NSC_TOKEN_SPEC", tokenSpec);
const tokenFile = "/var/run/nsc/token.json";
if (fs__WEBPACK_IMPORTED_MODULE_3__.existsSync(tokenFile)) {
_actions_core__WEBPACK_IMPORTED_MODULE_0__.exportVariable("NSC_TOKEN_FILE", tokenFile);
return;
}
yield _actions_exec__WEBPACK_IMPORTED_MODULE_2__.exec("nsc auth exchange-github-token");
Expand Down
7 changes: 3 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ function getDownloadURL(): string {
}

async function ensureNscloudToken() {
const tokenSpecFile = "/var/run/nsc/token.spec";
if (fs.existsSync(tokenSpecFile)) {
const tokenSpec = fs.readFileSync(tokenSpecFile, "utf8");
core.exportVariable("NSC_TOKEN_SPEC", tokenSpec);
const tokenFile = "/var/run/nsc/token.json";
if (fs.existsSync(tokenFile)) {
core.exportVariable("NSC_TOKEN_FILE", tokenFile);
return
}

Expand Down

0 comments on commit e2efa3a

Please sign in to comment.