Skip to content

Commit 2302dae

Browse files
authored
Update main.ts
Adds check to see if file exists before parsing, to handle the scenario in which the changeset includes a deleted workflow file.
1 parent 988a608 commit 2302dae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ async function run(context: typeof github.context): Promise<void> {
209209
console.log(line);
210210
let workflow: Workflow = { filePath: wf, actions: Array<Action>() };
211211
workflowFiles.push(workflow);
212-
console.log("\nReading:" + workflow.filePath);
212+
if (fs.existsSync(workflow.filePath)) {
213+
console.log("\nReading:" + workflow.filePath);
213214
try {
214215
let yaml: any = yamlParse.load(
215216
fs.readFileSync(workflow.filePath, "utf-8"),
@@ -232,6 +233,8 @@ async function run(context: typeof github.context): Promise<void> {
232233
}
233234
console.log(error);
234235
}
236+
}
237+
235238
});
236239

237240
//iterate through all the workflow files found

0 commit comments

Comments
 (0)