Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 4d4741b

Browse files
Add suggestions
1 parent 4f2558a commit 4d4741b

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

webhook_handlers/views/github.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -250,33 +250,23 @@ def push(self, request, *args, **kwargs):
250250
)
251251
return Response()
252252

253-
commits_queryset = Commit.objects.filter(
254-
~Q(branch=pushed_to_branch_name),
255-
repository=repo,
256-
commitid__in=[commit.get("id") for commit in commits],
257-
merged=False,
258-
)
259-
260253
if pushed_to_branch_name == repo.branch:
254+
commits_queryset = Commit.objects.filter(
255+
~Q(branch=pushed_to_branch_name),
256+
repository=repo,
257+
commitid__in=[commit.get("id") for commit in commits],
258+
merged=False,
259+
)
261260
commits_queryset.update(branch=pushed_to_branch_name, merged=True)
262261
log.info(
263-
"Pushed commits to default branch; setting merged to True",
262+
f"Branch name updated for commits to {pushed_to_branch_name}; setting merged to True",
264263
extra=dict(
265264
repoid=repo.repoid,
266265
github_webhook_event=self.event,
267266
commits=[commit.get("id") for commit in commits],
268267
),
269268
)
270269

271-
log.info(
272-
f"Branch name updated for commits to {pushed_to_branch_name}",
273-
extra=dict(
274-
repoid=repo.repoid,
275-
github_webhook_event=self.event,
276-
commits=[commit.get("id") for commit in commits],
277-
),
278-
)
279-
280270
most_recent_commit = commits[-1]
281271

282272
if regexp_ci_skip(most_recent_commit.get("message")):

0 commit comments

Comments
 (0)