Skip to content

Commit 8d35f62

Browse files
committed
Actually commit changes
1 parent 4a5778d commit 8d35f62

File tree

5 files changed

+34
-15
lines changed

5 files changed

+34
-15
lines changed

AddActionsWorkflow/AddActionsWorkflow.csproj

+5-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@
6868
<Generator>VsixManifestGenerator</Generator>
6969
<LastGenOutput>source.extension.cs</LastGenOutput>
7070
</None>
71+
<Content Include="lib\win32\x64\git2-e632535.dll">
72+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
73+
<IncludeInVSIX>true</IncludeInVSIX>
74+
</Content>
7175
<Content Include="LICENSE.txt">
7276
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
7377
<IncludeInVSIX>true</IncludeInVSIX>
@@ -93,7 +97,7 @@
9397
<PackageReference Include="CliWrap">
9498
<Version>3.6.4</Version>
9599
</PackageReference>
96-
<PackageReference Include="Community.VisualStudio.Toolkit.17">
100+
<PackageReference Include="Community.VisualStudio.Toolkit.17" ExcludeAssets="runtime">
97101
<Version>17.0.507</Version>
98102
</PackageReference>
99103
<PackageReference Include="Community.VisualStudio.VSCT" Version="16.0.29.6" PrivateAssets="all" />

AddActionsWorkflow/AddActionsWorkflowPackage.cs

-5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,5 @@ public sealed class AddActionsWorkflowPackage : ToolkitPackage
2020
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
2121
{
2222
await this.RegisterCommandsAsync();
23-
24-
// telemetry rating
25-
RatingPrompt rating = new("TimHeuer.AddActionsWorkflow", Vsix.Name, await General.GetLiveInstanceAsync());
26-
rating.RegisterSuccessfulUsage();
27-
await rating.PromptAsync();
2823
}
2924
}

AddActionsWorkflow/Commands/AddWorkflowCommand.cs

+26-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using AddActionsWorkflow.Options;
22
using CliWrap;
33
using LibGit2Sharp;
4+
using Microsoft;
45
using System.Diagnostics;
56
using System.IO;
7+
using System.Linq;
68
using System.Text;
79
using System.Threading.Tasks;
810

@@ -48,12 +50,12 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
4850
proj = await sln.AddSolutionFolderAsync(options.SolutionFolderName);
4951

5052
_ = await proj?.AddExistingFilesAsync(Path.Combine(slnDir, @$".github\workflows\{finaleWorkflowname}.yaml"));
51-
await VS.StatusBar.ShowMessageAsync("GitHub Actions Worklfow creation finished.");
53+
await VS.StatusBar.ShowMessageAsync("GitHub Actions Workflow creation finished.");
5254
}
5355
else
5456
{
5557
// didn't happen, show an error
56-
await VS.StatusBar.ShowMessageAsync("GitHub Actions Worklfow creation failed.");
58+
await VS.StatusBar.ShowMessageAsync("GitHub Actions Workflow creation failed.");
5759
}
5860
}
5961

@@ -89,14 +91,11 @@ internal async Task<String> GetGitRootDirAsync(string workingDirectory, bool use
8991
await VS.StatusBar.ShowMessageAsync("Establishing git root directory...");
9092
var rootGitDir = workingDirectory;
9193

92-
while (!Directory.Exists(Path.Combine(rootGitDir, ".git")))
93-
{
94-
rootGitDir = Path.GetFullPath(Path.Combine(rootGitDir, ".."));
95-
}
94+
FindGitFolder(rootGitDir, out string gitPath);
9695

9796
try
9897
{
99-
using (var repo = new Repository(rootGitDir))
98+
using (var repo = new Repository(gitPath))
10099
{
101100
if (useCurrentBranch) branchName = repo.Head.FriendlyName;
102101
rootGitDir = repo.Info.WorkingDirectory;
@@ -109,4 +108,24 @@ internal async Task<String> GetGitRootDirAsync(string workingDirectory, bool use
109108

110109
return rootGitDir;
111110
}
111+
112+
internal void FindGitFolder(string path, out string foundPath)
113+
{
114+
foundPath = null;
115+
// Check if the current directory contains a .git folder
116+
if (Directory.Exists(Path.Combine(path, ".git")))
117+
{
118+
foundPath = path;
119+
return;
120+
}
121+
else
122+
{
123+
string parentPath = Directory.GetParent(path)?.FullName;
124+
if (!string.IsNullOrEmpty(parentPath))
125+
{
126+
FindGitFolder(parentPath, out foundPath); // Recursively search the parent directory
127+
}
128+
}
129+
return;
130+
}
112131
}

AddActionsWorkflow/Options/General.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal partial class OptionsProvider
99
public class GeneralOptions : BaseOptionPage<General> { }
1010
}
1111

12-
public class General : BaseOptionModel<General>, IRatingConfig
12+
public class General : BaseOptionModel<General>
1313
{
1414
[Category("Generator")]
1515
[DisplayName("Default file name")]

vs-publish.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
},
88
"overview": "README.md",
99
"publisher": "TimHeuer",
10-
"repo": "https://github.com/timheuer/AddActionsWorkflow"
10+
"repo": "https://github.com/timheuer/AddActionsWorkflow",
11+
"qna": false
1112
}

0 commit comments

Comments
 (0)