Skip to content
Draft
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
7 changes: 5 additions & 2 deletions lib/cleanup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4241,8 +4241,11 @@ function cleanup() {
}
}
catch (error) {
core.warning(`Login cleanup failed with ${error}. Cleanup will be skipped.`);
core.debug(error.stack);
const errorMessage = error instanceof Error ? error.message : String(error);
core.warning(`Login cleanup failed with ${errorMessage}. Cleanup will be skipped.`);
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
}
});
}
Expand Down
9 changes: 6 additions & 3 deletions lib/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4770,7 +4770,7 @@ function main() {
try {
(0, Utils_1.setUserAgent)();
const preCleanup = process.env.AZURE_LOGIN_PRE_CLEANUP;
if ('true' == preCleanup) {
if ('true' === preCleanup) {
yield (0, Utils_1.cleanupAzCLIAccounts)();
if (core.getInput('enable-AzPSSession').toLowerCase() === "true") {
yield (0, Utils_1.cleanupAzPSAccounts)();
Expand All @@ -4790,8 +4790,11 @@ function main() {
}
}
catch (error) {
core.setFailed(`Login failed with ${error}. Double check if the 'auth-type' is correct. Refer to https://github.com/Azure/login#readme for more information.`);
core.debug(error.stack);
const errorMessage = error instanceof Error ? error.message : String(error);
core.setFailed(`Login failed with ${errorMessage}. Double check if the 'auth-type' is correct. Refer to https://github.com/Azure/login#readme for more information.`);
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/Cli/AzureCliLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class AzureCliLogin {
core.debug(`Azure CLI path: ${this.azPath}`);

let output: string = "";
const execOptions: any = {
const execOptions: ExecOptions = {
listeners: {
stdout: (data: Buffer) => {
output += data.toString();
Expand Down Expand Up @@ -161,7 +161,7 @@ export class AzureCliLogin {
async executeAzCliCommand(
args: string[],
silent?: boolean,
execOptions: any = {}) {
execOptions: ExecOptions = {}) {
execOptions.silent = !!silent;
await exec.exec(`"${this.azPath}"`, args, execOptions);
}
Expand Down
3 changes: 2 additions & 1 deletion src/PowerShell/AzPSUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as core from '@actions/core';
import * as os from 'os';
import * as path from 'path';
import * as exec from '@actions/exec';
import { ExecOptions } from '@actions/exec/lib/interfaces';
import * as io from '@actions/io';
import AzPSScriptBuilder from './AzPSScriptBuilder';

Expand Down Expand Up @@ -54,7 +55,7 @@ export class AzPSUtils {
static async runPSScript(psScript: string): Promise<string> {
let outputString: string = "";
let commandStdErr = false;
const options: any = {
const options: ExecOptions = {
silent: true,
listeners: {
stdout: (data: Buffer) => {
Expand Down
7 changes: 5 additions & 2 deletions src/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ async function cleanup() {
}
}
catch (error) {
core.warning(`Login cleanup failed with ${error}. Cleanup will be skipped.`);
core.debug(error.stack);
const errorMessage = error instanceof Error ? error.message : String(error);
core.warning(`Login cleanup failed with ${errorMessage}. Cleanup will be skipped.`);
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
}
}

Expand Down
9 changes: 6 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ async function main() {
try {
setUserAgent();
const preCleanup: string = process.env.AZURE_LOGIN_PRE_CLEANUP;
if ('true' == preCleanup) {
if ('true' === preCleanup) {
await cleanupAzCLIAccounts();
if (core.getInput('enable-AzPSSession').toLowerCase() === "true") {
await cleanupAzPSAccounts();
Expand All @@ -31,8 +31,11 @@ async function main() {
}
}
catch (error) {
core.setFailed(`Login failed with ${error}. Double check if the 'auth-type' is correct. Refer to https://github.com/Azure/login#readme for more information.`);
core.debug(error.stack);
const errorMessage = error instanceof Error ? error.message : String(error);
core.setFailed(`Login failed with ${errorMessage}. Double check if the 'auth-type' is correct. Refer to https://github.com/Azure/login#readme for more information.`);
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
}
}

Expand Down