@@ -537,7 +537,7 @@ function run() {
537537 try {
538538 // Required inputs
539539 const token = core . getInput ( 'token' ) ;
540- const workflowName = core . getInput ( 'workflow' ) ;
540+ const workflowReference = core . getInput ( 'workflow' ) ;
541541 // Optional inputs, with defaults
542542 const ref = core . getInput ( 'ref' ) || github . context . ref ;
543543 const repo = core . getInput ( 'repo' ) || `${ github . context . repo . owner } /${ github . context . repo . repo } ` ;
@@ -559,14 +559,15 @@ function run() {
559559 // Debug response if ACTIONS_STEP_DEBUG is enabled
560560 core . debug ( listResp . data ) ;
561561 // Locate workflow by name as we need it's id
562- const workflowFind = listResp . data . workflows . find ( ( wf ) => {
563- return wf [ 'name' ] === workflowName ;
562+ const foundWorkflow = listResp . data . workflows . find ( ( wf ) => {
563+ // Match on name or id
564+ return ( wf [ 'name' ] === workflowReference || wf [ 'id' ] . toString ( ) === workflowReference ) ;
564565 } ) ;
565- if ( ! workflowFind )
566- throw new Error ( `Unable to find workflow named '${ workflowName } ' in ${ repo } 😥` ) ;
567- console . log ( `Workflow id is: ${ workflowFind . id } ` ) ;
566+ if ( ! foundWorkflow )
567+ throw new Error ( `Unable to find workflow '${ workflowReference } ' in ${ repo } 😥` ) ;
568+ console . log ( `Workflow id is: ${ foundWorkflow . id } ` ) ;
568569 // Call workflow_dispatch API
569- const dispatchResp = yield octokit . request ( `POST /repos/${ repo } /actions/workflows/${ workflowFind . id } /dispatches` , {
570+ const dispatchResp = yield octokit . request ( `POST /repos/${ repo } /actions/workflows/${ foundWorkflow . id } /dispatches` , {
570571 ref : ref ,
571572 inputs : inputs
572573 } ) ;
0 commit comments