@@ -16,7 +16,7 @@ async function run(): Promise<void> {
1616 try {
1717 // Required inputs
1818 const token = core . getInput ( 'token' )
19- const workflowName = core . getInput ( 'workflow' )
19+ const workflowRef = core . getInput ( 'workflow' )
2020 // Optional inputs, with defaults
2121 const ref = core . getInput ( 'ref' ) || github . context . ref
2222 const [ owner , repo ] = core . getInput ( 'repo' )
@@ -33,7 +33,7 @@ async function run(): Promise<void> {
3333 // Get octokit client for making API calls
3434 const octokit = github . getOctokit ( token )
3535
36- // List workflows via API
36+ // List workflows via API, and handle paginated results
3737 const workflows : ActionsGetWorkflowResponseData [ ] =
3838 await octokit . paginate ( octokit . actions . listRepoWorkflows . endpoint . merge ( { owner, repo, ref, inputs } ) )
3939
@@ -42,9 +42,9 @@ async function run(): Promise<void> {
4242 core . debug ( JSON . stringify ( workflows , null , 3 ) )
4343 core . debug ( '### END: List Workflows response data' )
4444
45- // Locate workflow by name as we need it's id
46- const workflowFind = workflows . find ( ( workflow ) => workflow . name === workflowName )
47- if ( ! workflowFind ) throw new Error ( `Unable to find workflow named '${ workflowName } ' in ${ owner } /${ repo } 😥` )
45+ // Locate workflow either by name or id
46+ const workflowFind = workflows . find ( ( workflow ) => workflow . name === workflowRef || workflow . id . toString ( ) === workflowRef )
47+ if ( ! workflowFind ) throw new Error ( `Unable to find workflow '${ workflowRef } ' in ${ owner } /${ repo } 😥` )
4848 console . log ( `Workflow id is: ${ workflowFind . id } ` )
4949
5050 // Call workflow_dispatch API
0 commit comments