Skip to content

Commit ba52b8c

Browse files
authored
fix: use realpathSync for main module check (#955)
1 parent edab2ce commit ba52b8c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

cleanup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as core from '@actions/core';
22
import * as exec from '@actions/exec';
3+
import { realpathSync } from 'node:fs';
34
import { fileURLToPath } from 'node:url';
45

56
/**
@@ -57,6 +58,6 @@ async function cleanup() {
5758
export default cleanup;
5859

5960
/* istanbul ignore next */
60-
if (process.argv[1] === fileURLToPath(import.meta.url)) {
61+
if (realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) {
6162
cleanup();
6263
}

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { NodeHttpHandler } from '@aws-sdk/node-http-handler';
55
import { fromHttp } from '@aws-sdk/credential-providers';
66
import { ECRClient, GetAuthorizationTokenCommand } from '@aws-sdk/client-ecr';
77
import { ECRPUBLICClient, GetAuthorizationTokenCommand as GetAuthorizationTokenCommandPublic } from '@aws-sdk/client-ecr-public';
8+
import { realpathSync } from 'node:fs';
89
import { fileURLToPath } from 'node:url';
910

1011
const ECR_LOGIN_GITHUB_ACTION_USER_AGENT = 'amazon-ecr-login-for-github-actions';
@@ -232,6 +233,6 @@ export {
232233
};
233234

234235
/* istanbul ignore next */
235-
if (process.argv[1] === fileURLToPath(import.meta.url)) {
236+
if (realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) {
236237
run();
237238
}

0 commit comments

Comments
 (0)