mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-11-29 11:24:23 +01:00
chore: vnext unit tests (#758)
* fix: unit tests * get unit tests running
This commit is contained in:
1 parent
d26f2d03f8
commit
7526948ef9
7 files changed
+50
-164
No files matched your search
@@ -54,7 +54,9 @@ export class CredentialsClient {
|
||||
const actualAccessKeyId = credentials.accessKeyId;
|
||||
|
||||
if (expectedAccessKeyId && expectedAccessKeyId !== actualAccessKeyId) {
|
||||
throw new Error('Unexpected failure: Credentials loaded by the SDK do not match the access key ID configured by the action');
|
||||
throw new Error(
|
||||
'Unexpected failure: Credentials loaded by the SDK do not match the access key ID configured by the action'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -87,7 +87,7 @@ export async function assumeRole(params: assumeRoleParams) {
|
||||
webIdentityTokenFile,
|
||||
webIdentityToken,
|
||||
inlineSessionPolicy,
|
||||
managedSessionPolicies
|
||||
managedSessionPolicies,
|
||||
} = { ...params };
|
||||
|
||||
// Load GitHub environment variables
|
||||
@@ -133,7 +133,7 @@ export async function assumeRole(params: assumeRoleParams) {
|
||||
Tags: tags ? tags : undefined,
|
||||
ExternalId: roleExternalId ? roleExternalId : undefined,
|
||||
Policy: inlineSessionPolicy ? inlineSessionPolicy : undefined,
|
||||
PolicyArns: managedSessionPolicies ? managedSessionPolicies : undefined,
|
||||
PolicyArns: managedSessionPolicies?.length ? managedSessionPolicies : undefined,
|
||||
};
|
||||
const keys = Object.keys(commonAssumeRoleParams) as Array<keyof typeof commonAssumeRoleParams>;
|
||||
keys.forEach((k) => commonAssumeRoleParams[k] === undefined && delete commonAssumeRoleParams[k]);
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ export function exportRegion(region: string) {
|
||||
}
|
||||
|
||||
// Obtains account ID from STS Client and sets it as output
|
||||
export async function exportAccountId(credentialsClient: CredentialsClient, maskAccountId?: string) {
|
||||
export async function exportAccountId(credentialsClient: CredentialsClient, maskAccountId?: boolean) {
|
||||
const client = credentialsClient.stsClient;
|
||||
const identity = await client.send(new GetCallerIdentityCommand({}));
|
||||
const accountId = identity.Account;
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@ export async function run() {
|
||||
const region = core.getInput('aws-region', { required: true });
|
||||
const roleToAssume = core.getInput('role-to-assume', { required: false });
|
||||
const audience = core.getInput('audience', { required: false });
|
||||
const maskAccountId = core.getInput('mask-aws-account-id', { required: false });
|
||||
const maskAccountId = core.getBooleanInput('mask-aws-account-id', { required: false });
|
||||
const roleExternalId = core.getInput('role-external-id', { required: false });
|
||||
const webIdentityTokenFile = core.getInput('web-identity-token-file', { required: false });
|
||||
const roleDuration = parseInt(core.getInput('role-duration-seconds', { required: false })) || DEFAULT_ROLE_DURATION;
|
||||
@@ -27,10 +27,10 @@ export async function run() {
|
||||
const proxyServer = core.getInput('http-proxy', { required: false });
|
||||
const disableOIDC = core.getInput('disable-oidc', { required: false });
|
||||
const inlineSessionPolicy = core.getInput('inline-session-policy', { required: false });
|
||||
const managedSessionPoliciesInput = core.getMultilineInput('managed-session-policies', { required: false })
|
||||
const managedSessionPoliciesInput = core.getMultilineInput('managed-session-policies', { required: false });
|
||||
const managedSessionPolicies: any[] = [];
|
||||
for (const managedSessionPolicy of managedSessionPoliciesInput) {
|
||||
managedSessionPolicies.push({arn: managedSessionPolicy});
|
||||
managedSessionPolicies.push({ arn: managedSessionPolicy });
|
||||
}
|
||||
const roleChainingInput = core.getInput('role-chaining', { required: false }) || 'false';
|
||||
const roleChaining = roleChainingInput.toLowerCase() === 'true';
|
||||
|
||||
Reference in new issue
Block a user