Skip to content

Commit 091153e

Browse files
committed
added check for file existence
1 parent d39c651 commit 091153e

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

dist/index.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,11 +1246,17 @@ const readSolutionFilters = async (
12461246
): Promise<SolutionFilter[]> => {
12471247
const results: SolutionFilter[] = []
12481248
for (const filename of solutionFilterFilesArray) {
1249+
if (!(await exists(filename))) {
1250+
core.error(`File does not exist: ${filename}`)
1251+
throw new Error(`File does not exist: ${filename}`)
1252+
}
1253+
12491254
const fileContents = await fs.readFile(filename, 'utf8')
12501255
const solutionFilter: SolutionFilter = JSON.parse(fileContents)
12511256
solutionFilter.filename = filename
12521257
results.push(solutionFilter)
12531258
}
1259+
12541260
return results
12551261
}
12561262

@@ -1317,7 +1323,10 @@ export const getYamlFilePatterns = async ({
13171323
// check if the solution filter is in a subdirectory
13181324
const lastSlash = solutionFilter.filename.lastIndexOf('/')
13191325
if (lastSlash !== -1) {
1320-
const subDirectory = solutionFilter.filename.substring(0, lastSlash+1)
1326+
const subDirectory = solutionFilter.filename.substring(
1327+
0,
1328+
lastSlash + 1
1329+
)
13211330

13221331
core.debug(` Found subdirectory ${subDirectory}`)
13231332
// Add the subdirectory to the include string

0 commit comments

Comments
 (0)