Skip to content

Commit a68f90e

Browse files
committed
changes in runner info
1 parent 12e8962 commit a68f90e

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

lib/loginAzurePowerShell.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,36 @@ var __importStar = (this && this.__importStar) || function (mod) {
1616
return result;
1717
};
1818
Object.defineProperty(exports, "__esModule", { value: true });
19+
const os = __importStar(require("os"));
1920
const core = __importStar(require("@actions/core"));
2021
const exec = __importStar(require("@actions/exec"));
2122
const io = __importStar(require("@actions/io"));
2223
var psPath;
2324
exports.initializeAz = (servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId) => __awaiter(void 0, void 0, void 0, function* () {
2425
psPath = yield io.which("pwsh", true);
2526
setPSModulePath();
26-
setPSModulePath(yield getLatestAzModule());
27+
setPSModulePath(yield getLatestModule());
2728
yield loginToAzure(servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId);
2829
});
2930
function setPSModulePath(azPSVersion = "") {
3031
let modulePath = "";
31-
switch (process.env.RUNNER_OS) {
32+
const RUNNER = process.env.RUNNER_OS || os.type();
33+
switch (RUNNER) {
3234
case "Linux":
3335
modulePath = `/usr/share/${azPSVersion}:`;
3436
break;
3537
case "Windows":
38+
case "Windows_NT":
3639
modulePath = `C:\\Modules\\${azPSVersion};`;
3740
break;
3841
case "macOS":
42+
case "Darwin":
3943
// TODO: add modulepath
4044
break;
4145
}
4246
process.env.PSModulePath = `${modulePath}${process.env.PSModulePath}`;
4347
}
44-
function getLatestAzModule() {
48+
function getLatestModule() {
4549
return __awaiter(this, void 0, void 0, function* () {
4650
const moduleName = "Az.Accounts";
4751
let output = "";

src/loginAzurePowerShell.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,39 @@
1+
import * as os from 'os';
12
import * as core from '@actions/core';
23
import * as exec from '@actions/exec';
34
import * as io from '@actions/io';
5+
import { defaultCoreCipherList } from 'constants';
46

57
var psPath: string;
68

79
export const initializeAz = async (servicePrincipalId: string, servicePrincipalKey: string, tenantId: string, subscriptionId: string) => {
810
psPath = await io.which("pwsh", true);
911
setPSModulePath();
10-
setPSModulePath(await getLatestAzModule());
12+
setPSModulePath(await getLatestModule());
1113
await loginToAzure(servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId);
1214
}
1315

14-
function setPSModulePath(azPSVersion = "") {
16+
function setPSModulePath(azPSVersion: string = "") {
1517
let modulePath: string = "";
16-
switch (process.env.RUNNER_OS) {
18+
const RUNNER: string = process.env.RUNNER_OS || os.type();
19+
switch (RUNNER) {
1720
case "Linux":
1821
modulePath = `/usr/share/${azPSVersion}:`;
1922
break;
2023
case "Windows":
24+
case "Windows_NT":
2125
modulePath = `C:\\Modules\\${azPSVersion};`;
2226
break;
2327
case "macOS":
28+
case "Darwin":
2429
// TODO: add modulepath
2530
break;
2631
}
2732
process.env.PSModulePath = `${modulePath}${process.env.PSModulePath}`;
2833
}
2934

30-
async function getLatestAzModule() {
31-
const moduleName = "Az.Accounts";
35+
async function getLatestModule() {
36+
const moduleName: string = "Az.Accounts";
3237
let output: string = "";
3338
let error: string = "";
3439
let options: any = {

0 commit comments

Comments
 (0)