Skip to content

Commit

Permalink
Use correct commit SHA
Browse files Browse the repository at this point in the history
  • Loading branch information
vbreuss committed Mar 30, 2024
1 parent 009995f commit 6467f0e
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,19 @@ await response.Content.ReadAsStreamAsync(cancellationToken),
titleProperty.GetString() == null)
{
return StatusCode(StatusCodes.Status500InternalServerError,
$"GitHub API '{requestUri}' returned an invalid response");
$"GitHub API '{requestUri}' returned an invalid response (missing title).");
}

if (!jsonDocument.RootElement.TryGetProperty("head", out var headProperty) ||
!headProperty.TryGetProperty("sha", out var shaProperty) ||
shaProperty.GetString() == null)
{
return StatusCode(StatusCodes.Status500InternalServerError,
$"GitHub API '{requestUri}' returned an invalid response (missing head.sha).");
}

var title = titleProperty.GetString()!;
var commitSha = pullRequestModel.Payload.PullRequest.MergeCommitSha;
var commitSha = shaProperty.GetString();
var statusUri = $"https://api.github.com/repos/{owner}/{repo}/statuses/{commitSha}";
var hasValidTitle = ValidateTitle(title);
// https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#create-a-commit-status
Expand Down

0 comments on commit 6467f0e

Please sign in to comment.