|
9 | 9 | import {getGitHubContextForWorkspaceUri, GitHubRepoContext} from "../git/repository"; |
10 | 10 |
|
11 | 11 | import {sep} from "path"; |
12 | | -import {logError} from "../log"; |
| 12 | +import {log, logError} from "../log"; |
13 | 13 | import {Workflow} from "../model"; |
14 | 14 | import {RunStore} from "../store/store"; |
15 | 15 | import {WorkflowRun} from "../store/workflowRun"; |
@@ -105,15 +105,25 @@ async function updatePinnedWorkflows() { |
105 | 105 | } |
106 | 106 |
|
107 | 107 | // Get all workflows to resolve names. We could do this locally, but for now, let's make the API call. |
108 | | - const workflows = await gitHubRepoContext.client.actions.listRepoWorkflows({ |
109 | | - owner: gitHubRepoContext.owner, |
110 | | - repo: gitHubRepoContext.name |
111 | | - }); |
| 108 | + const workflows = await gitHubRepoContext.client.paginate( |
| 109 | + gitHubRepoContext.client.actions.listRepoWorkflows, |
| 110 | + { |
| 111 | + owner: gitHubRepoContext.owner, |
| 112 | + repo: gitHubRepoContext.name, |
| 113 | + per_page: 100 |
| 114 | + }, |
| 115 | + response => response.data |
| 116 | + ); |
112 | 117 |
|
113 | 118 | const workflowByPath: {[id: string]: Workflow} = {}; |
114 | | - workflows.data.workflows.forEach(w => (workflowByPath[w.path] = w)); |
| 119 | + workflows.forEach(w => (workflowByPath[w.path] = w)); |
115 | 120 |
|
116 | 121 | for (const pinnedWorkflow of workflowsByWorkspace.get(workspaceName) || []) { |
| 122 | + if (!workflowByPath[pinnedWorkflow]) { |
| 123 | + log(`Unable to find pinned workflow ${pinnedWorkflow} in ${workspaceName}, ignoring`); |
| 124 | + continue; |
| 125 | + } |
| 126 | + |
117 | 127 | const pW = createPinnedWorkflow(gitHubRepoContext, workflowByPath[pinnedWorkflow]); |
118 | 128 | await refreshPinnedWorkflow(pW); |
119 | 129 | } |
|
0 commit comments