Skip to content

Commit

Permalink
move pre cleanup to main and add pre-if and post-if (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
YanaXu authored Sep 14, 2024
1 parent ffd504a commit 73ceb51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ branding:
color: 'blue'
runs:
using: 'node20'
pre: 'lib/cleanup/index.js'
main: 'lib/main/index.js'
post-if: (!env.AZURE_LOGIN_POST_CLEANUP || env.AZURE_LOGIN_POST_CLEANUP != 'false')
post: 'lib/cleanup/index.js'
9 changes: 8 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import * as core from '@actions/core';
import { setUserAgent } from './common/Utils';
import { cleanupAzCLIAccounts, cleanupAzPSAccounts, setUserAgent } from './common/Utils';
import { AzPSLogin } from './PowerShell/AzPSLogin';
import { LoginConfig } from './common/LoginConfig';
import { AzureCliLogin } from './Cli/AzureCliLogin';

async function main() {
try {
setUserAgent();
const preCleanup: string = process.env.AZURE_LOGIN_PRE_CLEANUP;
if ('true' == preCleanup) {
await cleanupAzCLIAccounts();
if (core.getInput('enable-AzPSSession').toLowerCase() === "true") {
await cleanupAzPSAccounts();
}
}

// prepare the login configuration
var loginConfig = new LoginConfig();
Expand Down

0 comments on commit 73ceb51

Please sign in to comment.