From ff8b017b2e582c37291207dd80c6057c2df0ca13 Mon Sep 17 00:00:00 2001 From: Wangchong Zhou Date: Sat, 3 Aug 2024 17:05:46 +0800 Subject: [PATCH] Fix issue when a wrong workflowRef is used (#77) * Fix issue when a wrong workflowRef is used * Also match top level workflow files --- src/main.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index db2c9a5..175d12d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -55,7 +55,8 @@ async function run(): Promise { 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} 😥`)