mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-03-12 18:07:10 -04:00
chore(deps-dev): bump @biomejs/biome from 1.9.4 to 2.1.2 (#1410)
* chore(deps-dev): bump @biomejs/biome from 1.9.4 to 2.1.2 Bumps [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) from 1.9.4 to 2.1.2. - [Release notes](https://github.com/biomejs/biome/releases) - [Changelog](https://github.com/biomejs/biome/blob/main/packages/@biomejs/biome/CHANGELOG.md) - [Commits](https://github.com/biomejs/biome/commits/@biomejs/biome@2.1.2/packages/@biomejs/biome) --- updated-dependencies: - dependency-name: "@biomejs/biome" dependency-version: 2.1.2 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * chore: bump biome and fix linting errors --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kellertk <kellertk@amazon.com> Co-authored-by: Tom Keller <1083460+kellertk@users.noreply.github.com>
This commit is contained in:
committed by
kellertk
parent
a16a4a650d
commit
9f25b942f3
@@ -1,2 +1,2 @@
|
|||||||
const { fs } = require('memfs')
|
const { fs } = require('memfs');
|
||||||
module.exports = fs
|
module.exports = fs;
|
||||||
|
|||||||
18
biome.jsonc
18
biome.jsonc
@@ -4,18 +4,18 @@
|
|||||||
"lineWidth": 120,
|
"lineWidth": 120,
|
||||||
"indentWidth": 2,
|
"indentWidth": 2,
|
||||||
"lineEnding": "lf",
|
"lineEnding": "lf",
|
||||||
"enabled": true,
|
"enabled": true
|
||||||
},
|
},
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
"performance": {
|
"performance": {
|
||||||
"noDelete": "off",
|
"noDelete": "off"
|
||||||
},
|
},
|
||||||
"complexity": {
|
"complexity": {
|
||||||
"noExtraBooleanCast": "off",
|
"noExtraBooleanCast": "off"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
"javascript": {
|
"javascript": {
|
||||||
"formatter": {
|
"formatter": {
|
||||||
@@ -23,12 +23,12 @@
|
|||||||
"jsxQuoteStyle": "double",
|
"jsxQuoteStyle": "double",
|
||||||
"quoteStyle": "single",
|
"quoteStyle": "single",
|
||||||
"bracketSpacing": true,
|
"bracketSpacing": true,
|
||||||
"arrowParentheses": "always",
|
"arrowParentheses": "always"
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
"json": {
|
"json": {
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"trailingCommas": "all",
|
"trailingCommas": "none"
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
73
package-lock.json
generated
73
package-lock.json
generated
@@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@aws-sdk/credential-provider-env": "^3.858.0",
|
"@aws-sdk/credential-provider-env": "^3.858.0",
|
||||||
"@biomejs/biome": "1.9.4",
|
"@biomejs/biome": "2.1.3",
|
||||||
"@smithy/property-provider": "^4.0.3",
|
"@smithy/property-provider": "^4.0.3",
|
||||||
"@types/node": "^24.0.3",
|
"@types/node": "^24.0.3",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.3",
|
||||||
@@ -781,11 +781,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/biome": {
|
"node_modules/@biomejs/biome": {
|
||||||
"version": "1.9.4",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.1.3.tgz",
|
||||||
"integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==",
|
"integrity": "sha512-KE/tegvJIxTkl7gJbGWSgun7G6X/n2M6C35COT6ctYrAy7SiPyNvi6JtoQERVK/VRbttZfgGq96j2bFmhmnH4w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "MIT OR Apache-2.0",
|
"license": "MIT OR Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"biome": "bin/biome"
|
"biome": "bin/biome"
|
||||||
@@ -798,20 +797,20 @@
|
|||||||
"url": "https://opencollective.com/biome"
|
"url": "https://opencollective.com/biome"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@biomejs/cli-darwin-arm64": "1.9.4",
|
"@biomejs/cli-darwin-arm64": "2.1.3",
|
||||||
"@biomejs/cli-darwin-x64": "1.9.4",
|
"@biomejs/cli-darwin-x64": "2.1.3",
|
||||||
"@biomejs/cli-linux-arm64": "1.9.4",
|
"@biomejs/cli-linux-arm64": "2.1.3",
|
||||||
"@biomejs/cli-linux-arm64-musl": "1.9.4",
|
"@biomejs/cli-linux-arm64-musl": "2.1.3",
|
||||||
"@biomejs/cli-linux-x64": "1.9.4",
|
"@biomejs/cli-linux-x64": "2.1.3",
|
||||||
"@biomejs/cli-linux-x64-musl": "1.9.4",
|
"@biomejs/cli-linux-x64-musl": "2.1.3",
|
||||||
"@biomejs/cli-win32-arm64": "1.9.4",
|
"@biomejs/cli-win32-arm64": "2.1.3",
|
||||||
"@biomejs/cli-win32-x64": "1.9.4"
|
"@biomejs/cli-win32-x64": "2.1.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-darwin-arm64": {
|
"node_modules/@biomejs/cli-darwin-arm64": {
|
||||||
"version": "1.9.4",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.1.3.tgz",
|
||||||
"integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==",
|
"integrity": "sha512-LFLkSWRoSGS1wVUD/BE6Nlt2dSn0ulH3XImzg2O/36BoToJHKXjSxzPEMAqT9QvwVtk7/9AQhZpTneERU9qaXA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -826,9 +825,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-darwin-x64": {
|
"node_modules/@biomejs/cli-darwin-x64": {
|
||||||
"version": "1.9.4",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.1.3.tgz",
|
||||||
"integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==",
|
"integrity": "sha512-Q/4OTw8P9No9QeowyxswcWdm0n2MsdCwWcc5NcKQQvzwPjwuPdf8dpPPf4r+x0RWKBtl1FLiAUtJvBlri6DnYw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -843,9 +842,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-linux-arm64": {
|
"node_modules/@biomejs/cli-linux-arm64": {
|
||||||
"version": "1.9.4",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.1.3.tgz",
|
||||||
"integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==",
|
"integrity": "sha512-2hS6LgylRqMFmAZCOFwYrf77QMdUwJp49oe8PX/O8+P2yKZMSpyQTf3Eo5ewnsMFUEmYbPOskafdV1ds1MZMJA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -860,9 +859,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-linux-arm64-musl": {
|
"node_modules/@biomejs/cli-linux-arm64-musl": {
|
||||||
"version": "1.9.4",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.1.3.tgz",
|
||||||
"integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==",
|
"integrity": "sha512-KXouFSBnoxAWZYDQrnNRzZBbt5s9UJkIm40hdvSL9mBxSSoxRFQJbtg1hP3aa8A2SnXyQHxQfpiVeJlczZt76w==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -877,9 +876,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-linux-x64": {
|
"node_modules/@biomejs/cli-linux-x64": {
|
||||||
"version": "1.9.4",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.1.3.tgz",
|
||||||
"integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==",
|
"integrity": "sha512-NxlSCBhLvQtWGagEztfAZ4WcE1AkMTntZV65ZvR+J9jp06+EtOYEBPQndA70ZGhHbEDG57bR6uNvqkd1WrEYVA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -894,9 +893,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-linux-x64-musl": {
|
"node_modules/@biomejs/cli-linux-x64-musl": {
|
||||||
"version": "1.9.4",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.1.3.tgz",
|
||||||
"integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==",
|
"integrity": "sha512-KaLAxnROouzIWtl6a0Y88r/4hW5oDUJTIqQorOTVQITaKQsKjZX4XCUmHIhdEk8zMnaiLZzRTAwk1yIAl+mIew==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -911,9 +910,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-win32-arm64": {
|
"node_modules/@biomejs/cli-win32-arm64": {
|
||||||
"version": "1.9.4",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.1.3.tgz",
|
||||||
"integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==",
|
"integrity": "sha512-V9CUZCtWH4u0YwyCYbQ3W5F4ZGPWp2C2TYcsiWFNNyRfmOW1j/TY/jAurl33SaRjgZPO5UUhGyr9m6BN9t84NQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -928,9 +927,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-win32-x64": {
|
"node_modules/@biomejs/cli-win32-x64": {
|
||||||
"version": "1.9.4",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.1.3.tgz",
|
||||||
"integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==",
|
"integrity": "sha512-dxy599q6lgp8ANPpR8sDMscwdp9oOumEsVXuVCVT9N2vAho8uYXlCz53JhxX6LtJOXaE73qzgkGQ7QqvFlMC0g==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@aws-sdk/credential-provider-env": "^3.858.0",
|
"@aws-sdk/credential-provider-env": "^3.858.0",
|
||||||
"@biomejs/biome": "1.9.4",
|
"@biomejs/biome": "2.1.3",
|
||||||
"@smithy/property-provider": "^4.0.3",
|
"@smithy/property-provider": "^4.0.3",
|
||||||
"@types/node": "^24.0.3",
|
"@types/node": "^24.0.3",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.3",
|
||||||
|
|||||||
@@ -147,7 +147,6 @@ export async function assumeRole(params: assumeRoleParams) {
|
|||||||
PolicyArns: managedSessionPolicies?.length ? managedSessionPolicies : undefined,
|
PolicyArns: managedSessionPolicies?.length ? managedSessionPolicies : undefined,
|
||||||
};
|
};
|
||||||
const keys = Object.keys(commonAssumeRoleParams) as Array<keyof typeof commonAssumeRoleParams>;
|
const keys = Object.keys(commonAssumeRoleParams) as Array<keyof typeof commonAssumeRoleParams>;
|
||||||
// biome-ignore lint/complexity/noForEach: Legacy code
|
|
||||||
keys.forEach((k) => commonAssumeRoleParams[k] === undefined && delete commonAssumeRoleParams[k]);
|
keys.forEach((k) => commonAssumeRoleParams[k] === undefined && delete commonAssumeRoleParams[k]);
|
||||||
|
|
||||||
// Instantiate STS client
|
// Instantiate STS client
|
||||||
|
|||||||
@@ -178,7 +178,6 @@ export async function retryAndBackoff<T>(
|
|||||||
}
|
}
|
||||||
// It's retryable, so sleep and retry.
|
// It's retryable, so sleep and retry.
|
||||||
await sleep(Math.random() * (2 ** retries * base));
|
await sleep(Math.random() * (2 ** retries * base));
|
||||||
// biome-ignore lint/style/noParameterAssign: This is a loop variable
|
|
||||||
retries += 1;
|
retries += 1;
|
||||||
if (retries >= maxRetries) {
|
if (retries >= maxRetries) {
|
||||||
throw err;
|
throw err;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import type { AssumeRoleCommandOutput } from '@aws-sdk/client-sts';
|
import type { AssumeRoleCommandOutput } from '@aws-sdk/client-sts';
|
||||||
import { CredentialsClient } from './CredentialsClient';
|
|
||||||
import { assumeRole } from './assumeRole';
|
import { assumeRole } from './assumeRole';
|
||||||
|
import { CredentialsClient } from './CredentialsClient';
|
||||||
import {
|
import {
|
||||||
areCredentialsValid,
|
areCredentialsValid,
|
||||||
errorMessage,
|
errorMessage,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
||||||
import { cleanup } from '../src/cleanup';
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { mockClient } from 'aws-sdk-client-mock';
|
|
||||||
import { STSClient } from '@aws-sdk/client-sts';
|
import { STSClient } from '@aws-sdk/client-sts';
|
||||||
|
import { mockClient } from 'aws-sdk-client-mock';
|
||||||
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
|
import { cleanup } from '../src/cleanup';
|
||||||
import mocks from './mockinputs.test';
|
import mocks from './mockinputs.test';
|
||||||
|
|
||||||
const mockedSTSClient = mockClient(STSClient);
|
const mockedSTSClient = mockClient(STSClient);
|
||||||
@@ -49,5 +49,5 @@ describe('Configure AWS Credentials cleanup', {}, () => {
|
|||||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.NO_ENV_CREDS_INPUTS));
|
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.NO_ENV_CREDS_INPUTS));
|
||||||
cleanup();
|
cleanup();
|
||||||
expect(core.exportVariable).toHaveBeenCalledTimes(0);
|
expect(core.exportVariable).toHaveBeenCalledTimes(0);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, it, expect, vi } from 'vitest';
|
import { beforeEach } from 'node:test';
|
||||||
import * as helpers from '../src/helpers';
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { before, beforeEach } from 'node:test';
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
|
import * as helpers from '../src/helpers';
|
||||||
|
|
||||||
describe('Configure AWS Credentials helpers', {}, () => {
|
describe('Configure AWS Credentials helpers', {}, () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -27,7 +27,11 @@ describe('Configure AWS Credentials helpers', {}, () => {
|
|||||||
vi.spyOn(core, 'setOutput').mockImplementation(() => {});
|
vi.spyOn(core, 'setOutput').mockImplementation(() => {});
|
||||||
vi.spyOn(core, 'setSecret').mockImplementation(() => {});
|
vi.spyOn(core, 'setSecret').mockImplementation(() => {});
|
||||||
vi.spyOn(core, 'exportVariable').mockImplementation(() => {});
|
vi.spyOn(core, 'exportVariable').mockImplementation(() => {});
|
||||||
helpers.exportCredentials({ AccessKeyId: 'test', SecretAccessKey: 'test', SessionToken: 'test', Expiration: new Date(8640000000000000) }, true, true);
|
helpers.exportCredentials(
|
||||||
|
{ AccessKeyId: 'test', SecretAccessKey: 'test', SessionToken: 'test', Expiration: new Date(8640000000000000) },
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
);
|
||||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||||
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
||||||
expect(core.exportVariable).toHaveBeenCalledTimes(3);
|
expect(core.exportVariable).toHaveBeenCalledTimes(3);
|
||||||
@@ -46,7 +50,11 @@ describe('Configure AWS Credentials helpers', {}, () => {
|
|||||||
vi.spyOn(core, 'setOutput').mockImplementation(() => {});
|
vi.spyOn(core, 'setOutput').mockImplementation(() => {});
|
||||||
vi.spyOn(core, 'setSecret').mockImplementation(() => {});
|
vi.spyOn(core, 'setSecret').mockImplementation(() => {});
|
||||||
vi.spyOn(core, 'exportVariable').mockImplementation(() => {});
|
vi.spyOn(core, 'exportVariable').mockImplementation(() => {});
|
||||||
helpers.exportCredentials({ AccessKeyId: 'test', SecretAccessKey: 'test', SessionToken: 'test', Expiration: new Date(8640000000000000) }, true, false);
|
helpers.exportCredentials(
|
||||||
|
{ AccessKeyId: 'test', SecretAccessKey: 'test', SessionToken: 'test', Expiration: new Date(8640000000000000) },
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
);
|
||||||
helpers.unsetCredentials(false);
|
helpers.unsetCredentials(false);
|
||||||
helpers.exportRegion('fake-test-region', false);
|
helpers.exportRegion('fake-test-region', false);
|
||||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
import * as core from '@actions/core';
|
||||||
import {
|
import {
|
||||||
AssumeRoleCommand,
|
AssumeRoleCommand,
|
||||||
AssumeRoleWithWebIdentityCommand,
|
AssumeRoleWithWebIdentityCommand,
|
||||||
GetCallerIdentityCommand,
|
GetCallerIdentityCommand,
|
||||||
STSClient,
|
STSClient,
|
||||||
} from '@aws-sdk/client-sts';
|
} from '@aws-sdk/client-sts';
|
||||||
import { fs, vol } from 'memfs';
|
|
||||||
import * as core from '@actions/core';
|
|
||||||
import mocks from './mockinputs.test';
|
|
||||||
import { mockClient } from 'aws-sdk-client-mock';
|
import { mockClient } from 'aws-sdk-client-mock';
|
||||||
import { run } from '../src/index';
|
import { fs, vol } from 'memfs';
|
||||||
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
import { CredentialsClient } from '../src/CredentialsClient';
|
import { CredentialsClient } from '../src/CredentialsClient';
|
||||||
import { before } from 'node:test';
|
import { run } from '../src/index';
|
||||||
|
import mocks from './mockinputs.test';
|
||||||
|
|
||||||
const mockedSTSClient = mockClient(STSClient);
|
const mockedSTSClient = mockClient(STSClient);
|
||||||
|
|
||||||
@@ -300,19 +299,19 @@ describe('Configure AWS Credentials', {}, () => {
|
|||||||
await run();
|
await run();
|
||||||
expect(core.setFailed).toHaveBeenCalled();
|
expect(core.setFailed).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
it('gets new creds if told to reuse existing but they\'re invalid', {}, async () => {
|
it("gets new creds if told to reuse existing but they're invalid", {}, async () => {
|
||||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.USE_EXISTING_CREDENTIALS_INPUTS));
|
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.USE_EXISTING_CREDENTIALS_INPUTS));
|
||||||
mockedSTSClient.on(GetCallerIdentityCommand).rejects();
|
mockedSTSClient.on(GetCallerIdentityCommand).rejects();
|
||||||
await run();
|
await run();
|
||||||
expect(core.notice).toHaveBeenCalledWith('No valid credentials exist. Running as normal.')
|
expect(core.notice).toHaveBeenCalledWith('No valid credentials exist. Running as normal.');
|
||||||
});
|
});
|
||||||
it('doesn\'t get new creds if there are already valid ones and we said use them', {}, async () => {
|
it("doesn't get new creds if there are already valid ones and we said use them", {}, async () => {
|
||||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.USE_EXISTING_CREDENTIALS_INPUTS));
|
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.USE_EXISTING_CREDENTIALS_INPUTS));
|
||||||
mockedSTSClient.on(GetCallerIdentityCommand).resolves(mocks.outputs.GET_CALLER_IDENTITY);
|
mockedSTSClient.on(GetCallerIdentityCommand).resolves(mocks.outputs.GET_CALLER_IDENTITY);
|
||||||
await run();
|
await run();
|
||||||
expect(core.setFailed).not.toHaveBeenCalled();
|
expect(core.setFailed).not.toHaveBeenCalled();
|
||||||
})
|
});
|
||||||
it('doesn\'t export credentials as environment variables if told not to', {}, async () => {
|
it("doesn't export credentials as environment variables if told not to", {}, async () => {
|
||||||
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolvesOnce(mocks.outputs.STS_CREDENTIALS);
|
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolvesOnce(mocks.outputs.STS_CREDENTIALS);
|
||||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.NO_ENV_CREDS_INPUTS));
|
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.NO_ENV_CREDS_INPUTS));
|
||||||
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
vi.spyOn(core, 'getIDToken').mockResolvedValue('testoidctoken');
|
||||||
@@ -321,7 +320,7 @@ describe('Configure AWS Credentials', {}, () => {
|
|||||||
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
expect(core.setSecret).toHaveBeenCalledTimes(3);
|
||||||
expect(core.exportVariable).toHaveBeenCalledTimes(0);
|
expect(core.exportVariable).toHaveBeenCalledTimes(0);
|
||||||
expect(core.setFailed).not.toHaveBeenCalled();
|
expect(core.setFailed).not.toHaveBeenCalled();
|
||||||
})
|
});
|
||||||
it('can export creds as step outputs without exporting as env variables', {}, async () => {
|
it('can export creds as step outputs without exporting as env variables', {}, async () => {
|
||||||
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolvesOnce(mocks.outputs.STS_CREDENTIALS);
|
mockedSTSClient.on(AssumeRoleWithWebIdentityCommand).resolvesOnce(mocks.outputs.STS_CREDENTIALS);
|
||||||
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.STEP_BUT_NO_ENV_INPUTS));
|
vi.spyOn(core, 'getInput').mockImplementation(mocks.getInput(mocks.STEP_BUT_NO_ENV_INPUTS));
|
||||||
@@ -332,6 +331,6 @@ describe('Configure AWS Credentials', {}, () => {
|
|||||||
expect(core.exportVariable).toHaveBeenCalledTimes(0);
|
expect(core.exportVariable).toHaveBeenCalledTimes(0);
|
||||||
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
expect(core.setOutput).toHaveBeenCalledTimes(4);
|
||||||
expect(core.setFailed).not.toHaveBeenCalled();
|
expect(core.setFailed).not.toHaveBeenCalled();
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ const inputs = {
|
|||||||
NO_ENV_CREDS_INPUTS: {
|
NO_ENV_CREDS_INPUTS: {
|
||||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||||
'aws-region': 'fake-region-1',
|
'aws-region': 'fake-region-1',
|
||||||
'output-env-credentials': 'false'
|
'output-env-credentials': 'false',
|
||||||
},
|
},
|
||||||
STEP_BUT_NO_ENV_INPUTS: {
|
STEP_BUT_NO_ENV_INPUTS: {
|
||||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||||
'aws-region': 'fake-region-1',
|
'aws-region': 'fake-region-1',
|
||||||
'output-env-credentials': 'false',
|
'output-env-credentials': 'false',
|
||||||
'output-credentials': 'true',
|
'output-credentials': 'true',
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const envs = {
|
const envs = {
|
||||||
|
|||||||
@@ -19,17 +19,12 @@
|
|||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"disableSizeLimit": true,
|
"disableSizeLimit": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"lib": [ "ES2020" ],
|
"lib": ["ES2020"],
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"noErrorTruncation": true,
|
"noErrorTruncation": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"rootDir": "src",
|
"rootDir": "src"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src/**/*.ts"],
|
||||||
"src/**/*.ts"
|
"exclude": ["test/**/*.ts"]
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"test/**/*.ts"
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"include": [
|
"include": ["test/**/*.ts", "src/**/*.ts"],
|
||||||
"test/**/*.ts",
|
|
||||||
"src/**/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [],
|
"exclude": [],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "./"
|
"rootDir": "./"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user