Skip to content

Commit

Permalink
Merge pull request #33 from gittuf/fix-closed-pr-issue
Browse files Browse the repository at this point in the history
Fix race condition with GitHub API
  • Loading branch information
adityasaky authored Dec 6, 2024
2 parents c359445 + 52feb0d commit 95b9ad5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions internal/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ func (g *GittufApp) handlePush(ctx context.Context, event *github.PushEvent) err
if err != nil {
return fmt.Errorf("unable to identify pull requests associated with this commit: %w", err)
}
// FIXME: closed pull requests don't get returned here
if len(pullRequests) > 0 {
// we'll handle this in the PR merge / synchronize event
log.Default().Printf("Found pull request for commit %s", currentTip)
Expand Down Expand Up @@ -385,7 +384,7 @@ func (g *GittufApp) handlePullRequest(ctx context.Context, event *github.PullReq
return err
}

if err := repo.AddGitHubPullRequestAttestationForCommit(ctx, signer, owner, repository, event.GetPullRequest().GetMergeCommitSHA(), baseRef, true, githubopts.WithGitHubBaseURL(g.Params.GitHubURL), githubopts.WithGitHubToken(token)); err != nil {
if err := repo.AddGitHubPullRequestAttestationForNumber(ctx, signer, owner, repository, pullRequestNumber, true, githubopts.WithGitHubBaseURL(g.Params.GitHubURL), githubopts.WithGitHubToken(token)); err != nil {
log.Default().Printf("Unable to create pull request attestation: %v", err)
return err
}
Expand Down

0 comments on commit 95b9ad5

Please sign in to comment.