Skip to content

Commit 6b1d227

Browse files
authored
Use commit ID from build state (#603)
1 parent 4277e58 commit 6b1d227

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe/BuildServers/GitHubActionsBuildServer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ private static void UploadSarifToCodeScanning(IIssuesContext context)
133133
return;
134134
}
135135

136-
var commitSha = context.GitHubActions().Environment.Workflow.Sha;
137136
var ref_ = context.GitHubActions().Environment.Workflow.Ref;
138137

139138
// Read and encode SARIF file
@@ -144,7 +143,7 @@ private static void UploadSarifToCodeScanning(IIssuesContext context)
144143
var apiUrl = new Uri($"https://api.github.com/repos/{repository}/code-scanning/sarifs");
145144
var requestBody = new
146145
{
147-
commit_sha = commitSha,
146+
commit_sha = context.State.CommitId,
148147
ref_,
149148
sarif = sarifBase64,
150149
tool_name = "Cake.Issues.Recipe"

Cake.Issues.Recipe/Content/tasks/buildservers/GitHubActionsBuildServer.cake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ public class GitHubActionsBuildServer : BaseBuildServer
132132
return;
133133
}
134134

135-
var commitSha = context.GitHubActions().Environment.Workflow.Sha;
136135
var ref_ = context.GitHubActions().Environment.Workflow.Ref;
137136

138137
// Read and encode SARIF file
@@ -143,7 +142,7 @@ public class GitHubActionsBuildServer : BaseBuildServer
143142
var apiUrl = new System.Uri($"https://api.github.com/repos/{repository}/code-scanning/sarifs");
144143
var requestBody = new
145144
{
146-
commit_sha = commitSha,
145+
commit_sha = data.CommitId,
147146
ref_,
148147
sarif = sarifBase64,
149148
tool_name = "Cake.Issues.Recipe"

0 commit comments

Comments
 (0)