Skip to content

Commit 6f3d50a

Browse files
committed
decouple env creds output from log masking
1 parent aeb7571 commit 6f3d50a

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/helpers.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,33 @@ export function translateEnvVariables() {
3939

4040
// Configure the AWS CLI and AWS SDKs using environment variables and set them as secrets.
4141
// Setting the credentials as secrets masks them in Github Actions logs
42-
export function exportCredentials(creds?: Partial<Credentials>, outputCredentials?: boolean, outputEnvCredentials?: boolean) {
42+
export function exportCredentials(
43+
creds?: Partial<Credentials>,
44+
outputCredentials?: boolean,
45+
outputEnvCredentials?: boolean,
46+
) {
47+
if (creds?.AccessKeyId) {
48+
core.setSecret(creds.AccessKeyId);
49+
}
50+
51+
if (creds?.SecretAccessKey) {
52+
core.setSecret(creds.SecretAccessKey);
53+
}
54+
55+
if (creds?.SessionToken) {
56+
core.setSecret(creds.SessionToken);
57+
}
58+
4359
if (outputEnvCredentials) {
4460
if (creds?.AccessKeyId) {
45-
core.setSecret(creds.AccessKeyId);
4661
core.exportVariable('AWS_ACCESS_KEY_ID', creds.AccessKeyId);
4762
}
4863

4964
if (creds?.SecretAccessKey) {
50-
core.setSecret(creds.SecretAccessKey);
5165
core.exportVariable('AWS_SECRET_ACCESS_KEY', creds.SecretAccessKey);
5266
}
5367

5468
if (creds?.SessionToken) {
55-
core.setSecret(creds.SessionToken);
5669
core.exportVariable('AWS_SESSION_TOKEN', creds.SessionToken);
5770
} else if (process.env.AWS_SESSION_TOKEN) {
5871
// clear session token from previous credentials action

0 commit comments

Comments
 (0)