Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/PinAction/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,26 @@ internal static bool PinActionHash(string path)
try
{
// 获取该版本的 git commit hash
Reference reference = GitHubClient.Git.Reference.Get(repo.Split('/')[0], repo.Split('/')[1], $"{refType}/{tag}").Result;
hash = reference.Object.Sha;

string owner = repo.Split('/')[0];
string repository = repo.Split('/')[1];

Reference reference = GitHubClient.Git.Reference.Get(owner, repository, $"{refType}/{tag}").Result;
Comment thread
DuckDuckStudio marked this conversation as resolved.
TagObject gitObject = reference.Object;

while (gitObject.Type.Value == TaggedType.Tag)
{
GitTag gitTag = GitHubClient.Git.Tag.Get(owner, repository, gitObject.Sha).Result;
gitObject = gitTag.Object;
}

if (gitObject.Type.Value != TaggedType.Commit)
{
AnsiConsole.MarkupLine($"{Print.MSHead.Warning} [red]{Markup.Escape(string.Format(Strings.ErrorReferenceNotCommit, tag, $"{repo}@{tag}"))}[/]");
return false;
}

hash = gitObject.Sha;
PinedActions.TryAdd($"{repo}@{tag}", hash);
break;
}
Expand Down
11 changes: 10 additions & 1 deletion src/PinAction/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/PinAction/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
<value>The repository {0} does not exist.</value>
<comment>存储库不存在的错误信息</comment>
</data>
<data name="ErrorReferenceNotCommit" xml:space="preserve">
<value>The reference {0} did not resolve to a commit; skipping {1}.</value>
<comment>在引用最终不是指向提交时显示的错误信息</comment>
</data>
<data name="ErrorTagNotFound" xml:space="preserve">
<value>Tag {0} not found, maybe this is a branch reference? I'll give it a try...</value>
<comment>未找到标签引用的提示信息</comment>
Expand Down Expand Up @@ -178,7 +182,7 @@
<comment>许可(证)</comment>
</data>
<data name="NotARepository" xml:space="preserve">
<value>{0} doesn't look like a repository format; skip {1}</value>
<value>{0} doesn't look like a repository format; skipping {1}</value>
<comment>看起来不像存储库的</comment>
</data>
<data name="Package" xml:space="preserve">
Expand Down
3 changes: 3 additions & 0 deletions src/PinAction/Resources/Strings.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
<data name="ErrorRepositoryNotExist" xml:space="preserve">
<value>存储库 {0} 不存在。</value>
</data>
<data name="ErrorReferenceNotCommit" xml:space="preserve">
<value>引用 {0} 未能解析为提交,跳过 {1}。</value>
</data>
<data name="ErrorTagNotFound" xml:space="preserve">
<value>未找到标签 {0},也许这是分支引用?我试试看...</value>
</data>
Expand Down
Loading