1+ import { sep } from "path" ;
12import * as vscode from "vscode" ;
2-
3- import {
4- GitHubRepoContext ,
5- getGitHubContextForWorkspaceUri ,
6- } from "../git/repository" ;
73import {
84 getPinnedWorkflows ,
95 isPinnedWorkflowsRefreshEnabled ,
106 onPinnedWorkflowsChange ,
117 pinnedWorkflowsRefreshInterval ,
128} from "../configuration/configuration" ;
13-
9+ import {
10+ getGitHubContextForWorkspaceUri ,
11+ GitHubRepoContext ,
12+ } from "../git/repository" ;
1413import { WorkflowRun } from "../model" ;
1514import { getCodIconForWorkflowrun } from "../treeViews/icons" ;
16- import { sep } from "path" ;
1715
1816interface PinnedWorkflow {
1917 /** Displayed name */
2018 workflowName : string ;
2119
2220 workflowId : string ;
2321
22+ gitHubRepoContext : GitHubRepoContext ;
23+
2424 /** Status bar item created for this workflow */
2525 statusBarItem : vscode . StatusBarItem ;
2626}
@@ -107,22 +107,19 @@ async function updatePinnedWorkflows() {
107107 for ( const pinnedWorkflow of workflowsByWorkspace . get ( workspaceName ) ||
108108 [ ] ) {
109109 const pW = createPinnedWorkflow (
110+ gitHubRepoContext ,
110111 pinnedWorkflow ,
111112 workflowNameByPath [ pinnedWorkflow ]
112113 ) ;
113- await updatePinnedWorkflow ( gitHubRepoContext , pW ) ;
114+ await updatePinnedWorkflow ( pW ) ;
114115 }
115116 }
116117}
117118
118119async function refreshPinnedWorkflows ( ) {
119- // const gitHubContext = await getGitHubContext();
120- // if (!gitHubContext) {
121- // return;
122- // }
123- // for (const pinnedWorkflow of pinnedWorkflows) {
124- // await updatePinnedWorkflow(gitHubContext, pinnedWorkflow);
125- // }
120+ for ( const pinnedWorkflow of pinnedWorkflows ) {
121+ await updatePinnedWorkflow ( pinnedWorkflow ) ;
122+ }
126123}
127124
128125function clearPinnedWorkflows ( ) {
@@ -135,12 +132,17 @@ function clearPinnedWorkflows() {
135132 pinnedWorkflows . splice ( 0 , pinnedWorkflows . length ) ;
136133}
137134
138- function createPinnedWorkflow ( id : string , name : string ) : PinnedWorkflow {
135+ function createPinnedWorkflow (
136+ gitHubRepoContext : GitHubRepoContext ,
137+ id : string ,
138+ name : string
139+ ) : PinnedWorkflow {
139140 const statusBarItem = vscode . window . createStatusBarItem (
140141 vscode . StatusBarAlignment . Left
141142 ) ;
142143
143144 const pinnedWorkflow = {
145+ gitHubRepoContext,
144146 workflowId : id ,
145147 workflowName : name ,
146148 statusBarItem,
@@ -151,10 +153,9 @@ function createPinnedWorkflow(id: string, name: string): PinnedWorkflow {
151153 return pinnedWorkflow ;
152154}
153155
154- async function updatePinnedWorkflow (
155- gitHubRepoContext : GitHubRepoContext ,
156- pinnedWorkflow : PinnedWorkflow
157- ) {
156+ async function updatePinnedWorkflow ( pinnedWorkflow : PinnedWorkflow ) {
157+ const { gitHubRepoContext } = pinnedWorkflow ;
158+
158159 try {
159160 const runs = await gitHubRepoContext . client . actions . listWorkflowRuns ( {
160161 owner : gitHubRepoContext . owner ,
0 commit comments