mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-09-02 05:55:10 +09:00
chore!: move away from ESM
It turns out that Jest's ESM support still relies on experimental node modules (as of node 18). Switch back to commonjs instead.
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
import * as core from '@actions/core';
|
||||
import { AssumeRoleCommandInput, AssumeRoleWithWebIdentityCommand } from '@aws-sdk/client-sts';
|
||||
import { errorMessage, getStsClient, isDefined } from './helpers.js';
|
||||
import { errorMessage, getStsClient, isDefined } from './helpers';
|
||||
|
||||
const SANITIZATION_CHARACTER = '_';
|
||||
const MAX_TAG_VALUE_LENGTH = 256;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import * as url from 'node:url';
|
||||
import * as core from '@actions/core';
|
||||
import { errorMessage } from '../helpers.js';
|
||||
import { errorMessage } from '../helpers';
|
||||
|
||||
/**
|
||||
* When the GitHub Actions job is done, clean up any environment variables that
|
||||
@@ -28,8 +27,10 @@ export async function cleanup() {
|
||||
core.setFailed(errorMessage(error));
|
||||
}
|
||||
}
|
||||
|
||||
const modulePath = url.fileURLToPath(import.meta.url);
|
||||
if (process.argv[1] === modulePath) {
|
||||
await cleanup();
|
||||
if (require.main === module) {
|
||||
(async () => {
|
||||
await cleanup();
|
||||
})().catch((error) => {
|
||||
core.setFailed(errorMessage(error));
|
||||
});
|
||||
}
|
||||
|
||||
+8
-6
@@ -1,8 +1,7 @@
|
||||
import * as url from 'node:url';
|
||||
import * as core from '@actions/core';
|
||||
import { Credentials, GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts';
|
||||
import { assumeRole } from './assumeRole.js';
|
||||
import { errorMessage, getStsClient, retryAndBackoff } from './helpers.js';
|
||||
import { assumeRole } from './assumeRole';
|
||||
import { errorMessage, getStsClient, retryAndBackoff } from './helpers';
|
||||
|
||||
// Use 1hr as role duration when using session token or OIDC
|
||||
// Otherwise, use the max duration of GitHub action (6hr)
|
||||
@@ -204,7 +203,10 @@ export async function run() {
|
||||
}
|
||||
}
|
||||
|
||||
const modulePath = url.fileURLToPath(import.meta.url);
|
||||
if (process.argv[1] === modulePath) {
|
||||
await run();
|
||||
if (require.main === module) {
|
||||
(async () => {
|
||||
await run();
|
||||
})().catch((error) => {
|
||||
core.setFailed(error.message);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user