diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index f72df90a4..d6256e439 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -20780,20 +20780,23 @@ function determineProfilePath() { throw new Error(`Unexpected OS '${os}'`); } } -function setProfile(profile, creds) { +function setProfile(profile, region, creds) { if (!profile) { return; } const profilePath = determineProfilePath(); const profileSection = `[${profile}]`; - const profileCreds = creds || {}; + const profileCreds = { + ...creds, + AWS_REGION: region + }; const profileCredsString = Object.keys(profileCreds) .map((key) => `${key} = ${profileCreds[key]}`) .join('\n'); const profileString = `${profileSection}\n${profileCredsString}\n`; core.debug(`Writing profile ${profile} to ${profilePath}`); core.debug(`Profile string:\n${profileString}`); - fs.appendFileSync(profilePath, profileString); + fs.writeFileSync(profilePath, profileString); } exports.setProfile = setProfile; // Retries the promise with exponential backoff if the error isRetryable up to maxRetries time. diff --git a/dist/cleanup/src/helpers.d.ts b/dist/cleanup/src/helpers.d.ts index f94875363..06905d24a 100644 --- a/dist/cleanup/src/helpers.d.ts +++ b/dist/cleanup/src/helpers.d.ts @@ -10,7 +10,7 @@ declare let sleep: typeof defaultSleep; export declare function withsleep(s: typeof sleep): void; export declare function reset(): void; export declare function verifyKeys(creds: Partial | undefined): boolean; -export declare function setProfile(profile: string, creds?: Partial): void; +export declare function setProfile(profile: string, region: string, creds?: Partial): void; export declare function retryAndBackoff(fn: () => Promise, isRetryable: boolean, maxRetries?: number, retries?: number, base?: number): Promise; export declare function errorMessage(error: unknown): string; export declare function isDefined(i: T | undefined | null): i is T; diff --git a/dist/index.js b/dist/index.js index 9f77698a4..6ffdb58fb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -366,20 +366,23 @@ function determineProfilePath() { throw new Error(`Unexpected OS '${os}'`); } } -function setProfile(profile, creds) { +function setProfile(profile, region, creds) { if (!profile) { return; } const profilePath = determineProfilePath(); const profileSection = `[${profile}]`; - const profileCreds = creds || {}; + const profileCreds = { + ...creds, + AWS_REGION: region + }; const profileCredsString = Object.keys(profileCreds) .map((key) => `${key} = ${profileCreds[key]}`) .join('\n'); const profileString = `${profileSection}\n${profileCredsString}\n`; core.debug(`Writing profile ${profile} to ${profilePath}`); core.debug(`Profile string:\n${profileString}`); - fs.appendFileSync(profilePath, profileString); + fs.writeFileSync(profilePath, profileString); } exports.setProfile = setProfile; // Retries the promise with exponential backoff if the error isRetryable up to maxRetries time. @@ -596,7 +599,7 @@ async function run() { await credentialsClient.validateCredentials(roleCredentials.Credentials?.AccessKeyId); } await (0, helpers_1.exportAccountId)(credentialsClient, maskAccountId); - (0, helpers_1.setProfile)(profile, roleCredentials.Credentials); + (0, helpers_1.setProfile)(profile, region, roleCredentials.Credentials); } else { core.info('Proceeding with IAM user credentials');