@@ -27,7 +27,7 @@ public partial class GHActionsToolWindow : UserControl
27
27
private int maxRuns = 10 ;
28
28
private bool refreshPending = false ;
29
29
private int refreshInterval = 5 ;
30
-
30
+ OutputWindowPane _pane ;
31
31
32
32
public GHActionsToolWindow ( ToolWindowMessenger toolWindowMessenger )
33
33
{
@@ -68,6 +68,11 @@ private Task GotoRepoAsync()
68
68
69
69
public async Task GetRepoInfoAsync ( )
70
70
{
71
+ if ( _pane is null )
72
+ {
73
+ _pane = await VS . Windows . CreateOutputWindowPaneAsync ( "GitHub Actions for VS" ) ;
74
+ }
75
+
71
76
ClearTreeViews ( ) ;
72
77
_repoInfo . RepoOwner = null ;
73
78
_repoInfo . RepoName = null ;
@@ -80,10 +85,13 @@ public async Task GetRepoInfoAsync()
80
85
refreshInterval = generalSettings . RefreshInterval ;
81
86
refreshPending = generalSettings . RefreshActiveJobs ;
82
87
88
+ await _pane . WriteLineAsync ( "Extension settings retrieved and applied" ) ;
89
+
83
90
// find the git folder
84
91
var solution = await VS . Solutions . GetCurrentSolutionAsync ( ) ;
85
92
if ( solution is null )
86
93
{
94
+ await _pane . WriteLineAsync ( "No solution found" ) ;
87
95
Debug . WriteLine ( "No solution found" ) ;
88
96
ShowInfoMessage ( resx . NO_PROJ_LOADED ) ;
89
97
return ;
@@ -94,6 +102,7 @@ public async Task GetRepoInfoAsync()
94
102
95
103
if ( string . IsNullOrWhiteSpace ( gitPath ) )
96
104
{
105
+ await _pane . WriteLineAsync ( "No git repo found" ) ;
97
106
Debug . WriteLine ( "No git repo found" ) ;
98
107
ShowInfoMessage ( resx . NO_GIT_REPO ) ;
99
108
}
@@ -107,6 +116,7 @@ public async Task GetRepoInfoAsync()
107
116
}
108
117
else
109
118
{
119
+ await _pane . WriteLineAsync ( "Not a GitHub repo" ) ;
110
120
Debug . WriteLine ( "Not a GitHub repo" ) ;
111
121
ShowInfoMessage ( resx . GIT_NOT_GITHUB ) ;
112
122
}
@@ -154,13 +164,15 @@ private async Task LoadDataAsync()
154
164
// get workflows
155
165
await RefreshWorkflowsAsync ( client ) ;
156
166
167
+ await _pane . WriteLineAsync ( "Loading Workflow Runs..." ) ;
157
168
// get current branch
158
169
var runs = await client . Actions ? . Workflows ? . Runs ? . List ( _repoInfo . RepoOwner , _repoInfo . RepoName , new WorkflowRunsRequest ( ) { Branch = _repoInfo . CurrentBranch } , new ApiOptions ( ) { PageCount = 1 , PageSize = maxRuns } ) ;
159
170
160
171
List < SimpleRun > runsList = new List < SimpleRun > ( ) ;
161
172
162
173
if ( runs . TotalCount > 0 )
163
174
{
175
+ await _pane . WriteLineAsync ( $ "Number of runs found: { runs . TotalCount } ") ;
164
176
// creating simplified model of the GH info for the treeview
165
177
166
178
// iterate throught the runs
@@ -255,53 +267,84 @@ private async Task LoadDataAsync()
255
267
256
268
private async Task RefreshEnvironmentsAsync ( GitHubClient client )
257
269
{
258
- var repoEnvs = await client . Repository ? . Environment ? . GetAll ( _repoInfo . RepoOwner , _repoInfo . RepoName ) ;
259
270
List < SimpleEnvironment > envList = new List < SimpleEnvironment > ( ) ;
260
- if ( repoEnvs . TotalCount > 0 )
271
+ await _pane . WriteLineAsync ( "Loading Environments..." ) ;
272
+ try
261
273
{
262
- tvEnvironments . Header = $ "{ resx . HEADER_ENVIRONMENTS } ({ repoEnvs . TotalCount } )";
263
- foreach ( var env in repoEnvs . Environments )
274
+ var repoEnvs = await client . Repository ? . Environment ? . GetAll ( _repoInfo . RepoOwner , _repoInfo . RepoName ) ;
275
+
276
+ if ( repoEnvs . TotalCount > 0 )
264
277
{
265
- var envItem = new SimpleEnvironment
278
+ tvEnvironments . Header = $ "{ resx . HEADER_ENVIRONMENTS } ({ repoEnvs . TotalCount } )";
279
+ foreach ( var env in repoEnvs . Environments )
266
280
{
267
- Name = env . Name ,
268
- Url = env . HtmlUrl
269
- } ;
281
+ var envItem = new SimpleEnvironment
282
+ {
283
+ Name = env . Name ,
284
+ Url = env . HtmlUrl
285
+ } ;
270
286
271
- envList . Add ( envItem ) ;
287
+ envList . Add ( envItem ) ;
288
+ }
289
+ }
290
+ else
291
+ {
292
+ envList . Add ( new ( ) { Name = resx . NO_ENV } ) ;
272
293
}
273
294
}
274
- else
295
+ catch ( Exception ex )
275
296
{
276
- envList . Add ( new ( ) { Name = resx . NO_ENV } ) ;
297
+ envList . Add ( new SimpleEnvironment ( ) { Name = "Unable to retrieve Environments, please check logs" } ) ;
298
+ await ex . LogAsync ( ) ;
277
299
}
278
300
279
301
tvEnvironments . ItemsSource = envList ;
280
302
}
281
303
282
304
private async Task RefreshWorkflowsAsync ( GitHubClient client )
283
305
{
284
- var workflows = await client . Actions ? . Workflows ? . List ( _repoInfo . RepoOwner , _repoInfo . RepoName ) ;
285
- tvWorkflows . ItemsSource = workflows . Workflows ;
306
+ await _pane . WriteLineAsync ( "Loading Workflows..." ) ;
307
+ try
308
+ {
309
+ var workflows = await client . Actions ? . Workflows ? . List ( _repoInfo . RepoOwner , _repoInfo . RepoName ) ;
310
+ tvWorkflows . ItemsSource = workflows . Workflows ;
311
+ }
312
+ catch ( Exception ex )
313
+ {
314
+ await ex . LogAsync ( ) ;
315
+ }
316
+
286
317
}
287
318
private async Task RefreshSecretsAsync ( GitHubClient client )
288
319
{
289
- var repoSecrets = await client . Repository ? . Actions ? . Secrets ? . GetAll ( _repoInfo . RepoOwner , _repoInfo . RepoName ) ;
290
320
List < string > secretList = new ( ) ;
291
- if ( repoSecrets . TotalCount > 0 )
321
+ await _pane . WriteLineAsync ( "Loading Secrets..." ) ;
322
+ try
292
323
{
293
- tvSecrets . Header = $ "{ resx . HEADER_REPO_SECRETS } ({ repoSecrets . TotalCount } )";
294
- foreach ( var secret in repoSecrets . Secrets )
324
+ var repoSecrets = await client . Repository ? . Actions ? . Secrets ? . GetAll ( _repoInfo . RepoOwner , _repoInfo . RepoName ) ;
325
+
326
+ if ( repoSecrets . TotalCount > 0 )
295
327
{
296
- var updatedOrCreatedAt = secret . UpdatedAt . GetValueOrDefault ( secret . CreatedAt ) ;
297
- secretList . Add ( $ "{ secret . Name } ({ updatedOrCreatedAt : g} )") ;
328
+ await _pane . WriteLineAsync ( $ "Number of Repository Secrets found: { repoSecrets . TotalCount } ") ;
329
+ tvSecrets . Header = $ "{ resx . HEADER_REPO_SECRETS } ({ repoSecrets . TotalCount } )";
330
+ foreach ( var secret in repoSecrets . Secrets )
331
+ {
332
+ var updatedOrCreatedAt = secret . UpdatedAt . GetValueOrDefault ( secret . CreatedAt ) ;
333
+ secretList . Add ( $ "{ secret . Name } ({ updatedOrCreatedAt : g} )") ;
334
+ }
335
+ }
336
+ else
337
+ {
338
+ tvSecrets . Header = resx . HEADER_REPO_SECRETS ;
339
+ secretList . Add ( resx . NO_REPO_SECRETS ) ;
298
340
}
299
341
}
300
- else
342
+ catch ( Exception ex )
301
343
{
302
- tvSecrets . Header = resx . HEADER_REPO_SECRETS ;
303
- secretList . Add ( resx . NO_REPO_SECRETS ) ;
344
+ secretList . Add ( "Unable to retrieve Secrets, please check logs" ) ;
345
+ await ex . LogAsync ( ) ;
304
346
}
347
+
305
348
tvSecrets . ItemsSource = secretList ;
306
349
}
307
350
0 commit comments