diff --git a/src/GitHubActionsVS.csproj b/src/GitHubActionsVS.csproj
index fae559f..ac42425 100644
--- a/src/GitHubActionsVS.csproj
+++ b/src/GitHubActionsVS.csproj
@@ -52,6 +52,7 @@
+
diff --git a/src/Models/SimpleEnvironment.cs b/src/Models/SimpleEnvironment.cs
new file mode 100644
index 0000000..5e8363c
--- /dev/null
+++ b/src/Models/SimpleEnvironment.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+
+namespace GitHubActionsVS.Models;
+public class SimpleEnvironment
+{
+ public string Name { get; set; }
+ public string Url { get; set; }
+}
+
+
diff --git a/src/ToolWindows/GHActionsToolWindow.xaml b/src/ToolWindows/GHActionsToolWindow.xaml
index 4ba340f..966b1da 100644
--- a/src/ToolWindows/GHActionsToolWindow.xaml
+++ b/src/ToolWindows/GHActionsToolWindow.xaml
@@ -31,6 +31,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -51,21 +63,13 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/src/ToolWindows/GHActionsToolWindow.xaml.cs b/src/ToolWindows/GHActionsToolWindow.xaml.cs
index 214a605..00166f5 100644
--- a/src/ToolWindows/GHActionsToolWindow.xaml.cs
+++ b/src/ToolWindows/GHActionsToolWindow.xaml.cs
@@ -4,6 +4,7 @@
using Octokit;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@@ -114,6 +115,9 @@ private void ShowInfoMessage(string messageString)
private void ClearTreeViews()
{
tvSecrets.ItemsSource = null;
+ tvSecrets.Header = "Repository Secrets";
+ tvEnvironments.ItemsSource = null;
+ tvEnvironments.Header = "Environments";
tvCurrentBranch.ItemsSource = null;
CurrentBranchExpander.IsExpanded = false;
}
@@ -136,6 +140,8 @@ private async Task LoadDataAsync()
{
// get secrets
await RefreshSecretsAsync(client);
+ // get environments
+ await RefreshEnvironmentsAsync(client);
// get current branch
var runs = await client.Actions?.Workflows?.Runs?.List(_repoInfo.RepoOwner, _repoInfo.RepoName, new WorkflowRunsRequest() { Branch = _repoInfo.CurrentBranch }, new ApiOptions() { PageCount = 1, PageSize = maxRuns });
@@ -216,12 +222,39 @@ private async Task LoadDataAsync()
refreshProgress.IsIndeterminate = false;
}
+ private async Task RefreshEnvironmentsAsync(GitHubClient client)
+ {
+ var repoEnvs = await client.Repository?.Environment?.GetAll(_repoInfo.RepoOwner, _repoInfo.RepoName);
+ List envList = new List();
+ if (repoEnvs.TotalCount > 0)
+ {
+ tvEnvironments.Header = $"Environments ({repoEnvs.TotalCount})";
+ foreach (var env in repoEnvs.Environments)
+ {
+ var envItem = new SimpleEnvironment
+ {
+ Name = env.Name,
+ Url = env.HtmlUrl
+ };
+
+ envList.Add(envItem);
+ }
+ }
+ else
+ {
+ envList.Add(new() { Name = "No environments defined"});
+ }
+
+ tvEnvironments.ItemsSource = envList;
+ }
+
private async Task RefreshSecretsAsync(GitHubClient client)
{
var repoSecrets = await client.Repository?.Actions?.Secrets?.GetAll(_repoInfo.RepoOwner, _repoInfo.RepoName);
List secretList = new();
if (repoSecrets.TotalCount > 0)
{
+ tvSecrets.Header = $"Repository Secrets ({repoSecrets.TotalCount})";
foreach (var secret in repoSecrets.Secrets)
{
var updatedOrCreatedAt = secret.UpdatedAt.GetValueOrDefault(secret.CreatedAt);
@@ -230,6 +263,7 @@ private async Task RefreshSecretsAsync(GitHubClient client)
}
else
{
+ tvSecrets.Header = $"Repository Secrets";
secretList.Add("No repository secrets defined");
}
tvSecrets.ItemsSource = secretList;