@@ -16,6 +16,11 @@ const SIZE_LIMIT_HEADING = '## size-limit report 📦 ';
16
16
const ARTIFACT_NAME = 'size-limit-action' ;
17
17
const RESULTS_FILE = 'size-limit-results.json' ;
18
18
19
+ function getResultsFilePath ( ) {
20
+ const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
21
+ return path . resolve ( __dirname , RESULTS_FILE ) ;
22
+ }
23
+
19
24
const { getInput, setFailed } = core ;
20
25
21
26
async function fetchPreviousComment ( octokit , repo , pr ) {
@@ -46,7 +51,7 @@ async function execSizeLimit() {
46
51
}
47
52
48
53
async function run ( ) {
49
- const resultsFilePath = path . resolve ( __dirname , RESULTS_FILE ) ;
54
+ const __dirname = path . dirname ( fileURLToPath ( import . meta . url ) ) ;
50
55
51
56
try {
52
57
const { payload, repo } = context ;
@@ -62,7 +67,7 @@ async function run() {
62
67
63
68
const octokit = getOctokit ( githubToken ) ;
64
69
const limit = new SizeLimit ( ) ;
65
- const __dirname = path . dirname ( fileURLToPath ( import . meta . url ) ) ;
70
+ const resultsFilePath = getResultsFilePath ( ) ;
66
71
67
72
// If we have no comparison branch, we just run size limit & store the result as artifact
68
73
if ( ! comparisonBranch ) {
@@ -178,7 +183,7 @@ async function run() {
178
183
}
179
184
180
185
async function runSizeLimitOnComparisonBranch ( ) {
181
- const resultsFilePath = path . resolve ( __dirname , RESULTS_FILE ) ;
186
+ const resultsFilePath = getResultsFilePath ( ) ;
182
187
183
188
const limit = new SizeLimit ( ) ;
184
189
const artifactClient = artifact . create ( ) ;
0 commit comments