|
| 1 | +import * as vscode from "vscode"; |
1 | 2 | import {GitHubRepoContext} from "../git/repository"; |
2 | 3 | import {RepositoryPermission, hasWritePermission} from "../git/repository-permissions"; |
3 | 4 | import {log, logDebug} from "../log"; |
@@ -76,14 +77,22 @@ export class WorkflowRun extends WorkflowRunBase { |
76 | 77 | override async fetchJobs(): Promise<WorkflowJob[]> { |
77 | 78 | logDebug("Getting workflow jobs"); |
78 | 79 |
|
79 | | - const result = await this._gitHubRepoContext.client.actions.listJobsForWorkflowRun({ |
80 | | - owner: this._gitHubRepoContext.owner, |
81 | | - repo: this._gitHubRepoContext.name, |
82 | | - run_id: this.run.id |
83 | | - }); |
| 80 | + let jobs: model.WorkflowJob[] = []; |
| 81 | + |
| 82 | + try { |
| 83 | + jobs = await this._gitHubRepoContext.client.paginate( |
| 84 | + this._gitHubRepoContext.client.actions.listJobsForWorkflowRun, |
| 85 | + { |
| 86 | + owner: this._gitHubRepoContext.owner, |
| 87 | + repo: this._gitHubRepoContext.name, |
| 88 | + run_id: this.run.id, |
| 89 | + per_page: 100 |
| 90 | + } |
| 91 | + ); |
| 92 | + } catch (e) { |
| 93 | + await vscode.window.showErrorMessage((e as Error).message); |
| 94 | + } |
84 | 95 |
|
85 | | - const resp = result.data; |
86 | | - const jobs: model.WorkflowJob[] = resp.jobs; |
87 | 96 | return jobs.map(j => new WorkflowJob(this._gitHubRepoContext, j)); |
88 | 97 | } |
89 | 98 |
|
@@ -139,16 +148,23 @@ export class WorkflowRunAttempt extends WorkflowRunBase { |
139 | 148 |
|
140 | 149 | override async fetchJobs(): Promise<WorkflowJob[]> { |
141 | 150 | logDebug("Getting workflow run attempt jobs", this._run.id, "for attempt", this.attempt); |
| 151 | + let jobs: model.WorkflowJob[] = []; |
142 | 152 |
|
143 | | - const result = await this._gitHubRepoContext.client.actions.listJobsForWorkflowRunAttempt({ |
144 | | - owner: this._gitHubRepoContext.owner, |
145 | | - repo: this._gitHubRepoContext.name, |
146 | | - run_id: this._run.id, |
147 | | - attempt_number: this.attempt |
148 | | - }); |
| 153 | + try { |
| 154 | + jobs = await this._gitHubRepoContext.client.paginate( |
| 155 | + this._gitHubRepoContext.client.actions.listJobsForWorkflowRunAttempt, |
| 156 | + { |
| 157 | + owner: this._gitHubRepoContext.owner, |
| 158 | + repo: this._gitHubRepoContext.name, |
| 159 | + run_id: this.run.id, |
| 160 | + attempt_number: this.attempt, |
| 161 | + per_page: 100 |
| 162 | + } |
| 163 | + ); |
| 164 | + } catch (e) { |
| 165 | + await vscode.window.showErrorMessage((e as Error).message); |
| 166 | + } |
149 | 167 |
|
150 | | - const resp = result.data; |
151 | | - const jobs: model.WorkflowJob[] = resp.jobs; |
152 | 168 | return jobs.map(j => new WorkflowJob(this._gitHubRepoContext, j)); |
153 | 169 | } |
154 | 170 | } |
0 commit comments