Skip to content

Commit 1fd29b8

Browse files
committed
chore: fix CodeQL issue
1 parent 28d0b4e commit 1fd29b8

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,5 +286,5 @@ jobs:
286286
- name: Merge coverage (Delta)
287287
run: npm run test-merge-coverage:ci:affected
288288
- name: Report Coverage with Flags
289-
run: node ./scripts/codecov-upload-flags.mjs ${{ github.event.pull_request.head.label }} ${{ github.event.pull_request.head.sha }}
289+
run: node ./scripts/codecov-upload-flags.mjs ${{github.workspace}} ${{ github.event.pull_request.head.label }} ${{ github.event.pull_request.head.sha }}
290290

scripts/codecov-upload-flags.mjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ import { globSync } from 'glob';
33
import { chmodSync, existsSync, readFileSync } from 'fs';
44
import path from 'path';
55

6-
const branchName = process.argv[2];
7-
const commitSha = process.argv[3];
6+
const ROOT_DIR = process.argv[2];
7+
const branchName = process.argv[3];
8+
const commitSha = process.argv[4];
89

10+
if (typeof ROOT_DIR !== 'string') {
11+
console.log('Workspace missing! Exiting');
12+
process.exit(-1);
13+
}
914
if (typeof branchName !== 'string') {
1015
console.log('Branch name missing! Exiting');
1116
process.exit(-1);
@@ -15,9 +20,8 @@ if (typeof commitSha !== 'string') {
1520
process.exit(-1);
1621
}
1722

18-
const ROOT_DIR = process.cwd();
1923
const readPkg = (dir) => JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8'));
20-
const execCmd = (cmd, opts = {}) => execSync(cmd, {encoding: 'utf-8', stdio: 'inherit', ...opts});
24+
const execCmd = (cmd, opts = {}) => execSync(cmd, {cwd: ROOT_DIR, encoding: 'utf-8', stdio: 'inherit', ...opts});
2125

2226
const pkgInfo = readPkg(ROOT_DIR);
2327
const pkgFiles = pkgInfo.workspaces.map((exp) => globSync(path.join(exp, 'package.json')));

0 commit comments

Comments
 (0)