Skip to content

Commit 4af11af

Browse files
committed
fix module path
1 parent 4eb74cc commit 4af11af

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

dev-packages/size-limit-gh-action/index.mjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ const SIZE_LIMIT_HEADING = '## size-limit report 📦 ';
1616
const ARTIFACT_NAME = 'size-limit-action';
1717
const RESULTS_FILE = 'size-limit-results.json';
1818

19-
const RESULTS_FILE_PATH = path.resolve(__dirname, RESULTS_FILE);
20-
2119
const { getInput, setFailed } = core;
2220

2321
async function fetchPreviousComment(octokit, repo, pr) {
@@ -48,6 +46,8 @@ async function execSizeLimit() {
4846
}
4947

5048
async function run() {
49+
const resultsFilePath = path.resolve(__dirname, RESULTS_FILE);
50+
5151
try {
5252
const { payload, repo } = context;
5353
const pr = payload.pull_request;
@@ -96,7 +96,7 @@ async function run() {
9696
downloadPath: __dirname,
9797
});
9898

99-
base = JSON.parse(await fs.readFile(RESULTS_FILE_PATH, { encoding: 'utf8' }));
99+
base = JSON.parse(await fs.readFile(resultsFilePath, { encoding: 'utf8' }));
100100

101101
if (!artifacts.isLatest) {
102102
baseIsNotLatest = true;
@@ -178,20 +178,22 @@ async function run() {
178178
}
179179

180180
async function runSizeLimitOnComparisonBranch() {
181+
const resultsFilePath = path.resolve(__dirname, RESULTS_FILE);
182+
181183
const limit = new SizeLimit();
182184
const artifactClient = artifact.create();
183185

184186
const { output: baseOutput } = await execSizeLimit();
185187

186188
try {
187189
const base = limit.parseResults(baseOutput);
188-
await fs.writeFile(RESULTS_FILE_PATH, JSON.stringify(base), 'utf8');
190+
await fs.writeFile(resultsFilePath, JSON.stringify(base), 'utf8');
189191
} catch (error) {
190192
core.error('Error parsing size-limit output. The output should be a json.');
191193
throw error;
192194
}
193195

194-
const globber = await glob.create(RESULTS_FILE_PATH, {
196+
const globber = await glob.create(resultsFilePath, {
195197
followSymbolicLinks: false,
196198
});
197199
const files = await globber.glob();

0 commit comments

Comments
 (0)