@@ -545,7 +545,7 @@ function run() {
545545 try {
546546 // Required inputs
547547 const token = core . getInput ( 'token' ) ;
548- const workflowName = core . getInput ( 'workflow' ) ;
548+ const workflowRef = core . getInput ( 'workflow' ) ;
549549 // Optional inputs, with defaults
550550 const ref = core . getInput ( 'ref' ) || github . context . ref ;
551551 const [ owner , repo ] = core . getInput ( 'repo' )
@@ -559,16 +559,16 @@ function run() {
559559 }
560560 // Get octokit client for making API calls
561561 const octokit = github . getOctokit ( token ) ;
562- // List workflows via API
562+ // List workflows via API, and handle paginated results
563563 const workflows = yield octokit . paginate ( octokit . actions . listRepoWorkflows . endpoint . merge ( { owner, repo, ref, inputs } ) ) ;
564564 // Debug response if ACTIONS_STEP_DEBUG is enabled
565565 core . debug ( '### START List Workflows response data' ) ;
566566 core . debug ( JSON . stringify ( workflows , null , 3 ) ) ;
567567 core . debug ( '### END: List Workflows response data' ) ;
568- // Locate workflow by name as we need it's id
569- const workflowFind = workflows . find ( ( workflow ) => workflow . name === workflowName ) ;
568+ // Locate workflow either by name or id
569+ const workflowFind = workflows . find ( ( workflow ) => workflow . name === workflowRef || workflow . id . toString ( ) === workflowRef ) ;
570570 if ( ! workflowFind )
571- throw new Error ( `Unable to find workflow named '${ workflowName } ' in ${ owner } /${ repo } 😥` ) ;
571+ throw new Error ( `Unable to find workflow '${ workflowRef } ' in ${ owner } /${ repo } 😥` ) ;
572572 console . log ( `Workflow id is: ${ workflowFind . id } ` ) ;
573573 // Call workflow_dispatch API
574574 const dispatchResp = yield octokit . request ( `POST /repos/${ owner } /${ repo } /actions/workflows/${ workflowFind . id } /dispatches` , {
0 commit comments