Skip to content

Commit 3d1c7cc

Browse files
Address AI feedback
Signed-off-by: Lukasz Gryglicki <[email protected]> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot)
1 parent fc190de commit 3d1c7cc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cla-backend-go/github/github_repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ func GetPRHeadSHA(ctx context.Context, gh *github.Client, owner, repo string, pr
15291529
"repo": repo,
15301530
"pullRequestID": prNumber,
15311531
}
1532-
log.WithFields(f).WithError(err).Warnf("cannot get PR head SHA using PullRequests.Get: %+v, trying PullRequests.ListCommits", err)
1532+
log.WithFields(f).WithError(err).Warn("cannot get PR head SHA using PullRequests.Get, trying PullRequests.ListCommits")
15331533
opts := &github.ListOptions{PerPage: 1}
15341534
commits, resp, comErr := gh.PullRequests.ListCommits(ctx, owner, repo, prNumber, opts)
15351535
if comErr != nil {

cla-backend/cla/models/github_models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,8 +2648,12 @@ def update_pull_request(
26482648
commit_obj = pull_request.head.repo.get_commit(last_commit_sha)
26492649
except (GithubException, AttributeError, TypeError) as exc:
26502650
cla.log.error(f"{fn} - PR {pull_request.number}: exception getting head.sha: {exc}")
2651-
commit_obj = pull_request.get_commits().reversed[0]
2652-
last_commit_sha = commit_obj.sha
2651+
try:
2652+
commit_obj = pull_request.get_commits().reversed[0]
2653+
last_commit_sha = commit_obj.sha
2654+
except Exception as exc2:
2655+
cla.log.error(f"{fn} - PR {pull_request.number}: exception getting last commit from PR commits: {exc2}")
2656+
last_commit_sha = None
26532657
if not last_commit_sha:
26542658
cla.log.error(f"{fn} - PR {pull_request.number}: missing head.sha; cannot create statuses")
26552659
return

0 commit comments

Comments
 (0)