@@ -27,26 +27,34 @@ export class OctokitGitHub {
2727 } ) ;
2828 }
2929
30- workflows = async ( owner : string , repo : string ) =>
31- this . octokit . paginate ( this . octokit . actions . listRepoWorkflows , {
30+ workflows = async ( owner : string , repo : string ) => {
31+ debug ( `🔍 API Call: GET /repos/${ owner } /${ repo } /actions/workflows` ) ;
32+ const workflows = await this . octokit . paginate ( this . octokit . actions . listRepoWorkflows , {
3233 owner,
3334 repo,
3435 per_page : 100 ,
3536 } ) ;
37+ debug ( `📋 API Response: Found ${ workflows . length } workflows` ) ;
38+ debug ( `📋 Workflows details: ${ JSON . stringify ( workflows . map ( w => ( { id : w . id , name : w . name , state : w . state } ) ) , null , 2 ) } ` ) ;
39+ return workflows ;
40+ } ;
3641
3742 runs = async ( owner : string , repo : string , branch : string | undefined , workflow_id : number ) => {
3843 const options : Endpoints [ 'GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs' ] [ 'parameters' ] =
39- {
40- owner,
41- repo,
42- workflow_id,
43- per_page : 100 ,
44- } ;
44+ {
45+ owner,
46+ repo,
47+ workflow_id,
48+ per_page : 100 ,
49+ } ;
4550
4651 if ( branch ) {
4752 options . branch = branch ;
4853 }
4954
55+ debug ( `🔍 API Call: GET /repos/${ owner } /${ repo } /actions/workflows/${ workflow_id } /runs` ) ;
56+ debug ( `🔍 Request options: ${ JSON . stringify ( { ...options , branch : branch || 'all branches' } , null , 2 ) } ` ) ;
57+
5058 const in_progress_options = {
5159 ...options ,
5260 status : 'in_progress' as const ,
@@ -60,6 +68,8 @@ export class OctokitGitHub {
6068 status : 'waiting' as const ,
6169 } ;
6270
71+ debug ( `🔍 Making 3 parallel API calls for statuses: in_progress, queued, waiting` ) ;
72+
6373 const in_progress_runs = this . octokit . paginate (
6474 this . octokit . actions . listWorkflowRuns ,
6575 in_progress_options ,
@@ -75,21 +85,42 @@ export class OctokitGitHub {
7585 waiting_options ,
7686 ) ;
7787
78- return Promise . all ( [ in_progress_runs , queued_runs , waiting_runs ] ) . then ( ( values ) =>
79- values . flat ( ) ,
80- ) ;
88+ const [ inProgressResults , queuedResults , waitingResults ] = await Promise . all ( [ in_progress_runs , queued_runs , waiting_runs ] ) ;
89+
90+ debug ( `📋 API Response - in_progress runs: ${ inProgressResults . length } ` ) ;
91+ debug ( `📋 API Response - queued runs: ${ queuedResults . length } ` ) ;
92+ debug ( `📋 API Response - waiting runs: ${ waitingResults . length } ` ) ;
93+
94+ const allRuns = [ inProgressResults , queuedResults , waitingResults ] . flat ( ) ;
95+ debug ( `📋 Total runs found: ${ allRuns . length } ` ) ;
96+
97+ // Log detailed info about each run
98+ allRuns . forEach ( ( run , index ) => {
99+ debug ( `📋 Run ${ index + 1 } : ID=${ run . id } , status="${ run . status } ", conclusion="${ run . conclusion } ", created_at="${ run . created_at } ", branch="${ run . head_branch } "` ) ;
100+ } ) ;
101+
102+ return allRuns ;
81103 } ;
82104
83105 jobs = async ( owner : string , repo : string , run_id : number ) => {
84106 const options : Endpoints [ 'GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs' ] [ 'parameters' ] =
85- {
86- owner,
87- repo,
88- run_id,
89- per_page : 100 ,
90- } ;
91-
92- return this . octokit . paginate ( this . octokit . actions . listJobsForWorkflowRun , options ) ;
107+ {
108+ owner,
109+ repo,
110+ run_id,
111+ per_page : 100 ,
112+ } ;
113+
114+ debug ( `🔍 API Call: GET /repos/${ owner } /${ repo } /actions/runs/${ run_id } /jobs` ) ;
115+ const jobs = await this . octokit . paginate ( this . octokit . actions . listJobsForWorkflowRun , options ) ;
116+ debug ( `📋 API Response: Found ${ jobs . length } jobs for run ${ run_id } ` ) ;
117+
118+ // Log detailed info about each job
119+ jobs . forEach ( ( job , index ) => {
120+ debug ( `📋 Job ${ index + 1 } : ID=${ job . id } , name="${ job . name } ", status="${ job . status } ", conclusion="${ job . conclusion } ", started_at="${ job . started_at } "` ) ;
121+ } ) ;
122+
123+ return jobs ;
93124 } ;
94125
95126 steps = async ( owner : string , repo : string , job_id : number ) => {
@@ -98,7 +129,17 @@ export class OctokitGitHub {
98129 repo,
99130 job_id,
100131 } ;
132+
133+ debug ( `🔍 API Call: GET /repos/${ owner } /${ repo } /actions/jobs/${ job_id } ` ) ;
101134 const { data : job } = await this . octokit . actions . getJobForWorkflowRun ( options ) ;
102- return job . steps || [ ] ;
135+ const steps = job . steps || [ ] ;
136+ debug ( `📋 API Response: Found ${ steps . length } steps for job ${ job_id } ` ) ;
137+
138+ // Log detailed info about each step
139+ steps . forEach ( ( step , index ) => {
140+ debug ( `📋 Step ${ index + 1 } : name="${ step . name } ", status="${ step . status } ", conclusion="${ step . conclusion } ", started_at="${ step . started_at } "` ) ;
141+ } ) ;
142+
143+ return steps ;
103144 } ;
104145}
0 commit comments