Skip to content

Commit

Permalink
Fix issue when a wrong workflowRef is used (#77)
Browse files Browse the repository at this point in the history
* Fix issue when a wrong workflowRef is used

* Also match top level workflow files
  • Loading branch information
fffonion authored Aug 3, 2024
1 parent 25b02cc commit ff8b017
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ async function run(): Promise<void> {
const foundWorkflow = workflows.find((workflow) => {
return workflow.name === workflowRef ||
workflow.id.toString() === workflowRef ||
workflow.path.endsWith(workflowRef)
workflow.path.endsWith(`/${workflowRef}`) || // Add a leading / to avoid matching workflow with same suffix
workflow.path == workflowRef // Or it stays in top level directory
})

if(!foundWorkflow) throw new Error(`Unable to find workflow '${workflowRef}' in ${owner}/${repo} 😥`)
Expand Down

0 comments on commit ff8b017

Please sign in to comment.