Skip to content

Commit 4af08c0

Browse files
committed
Save all commits sha for push events
Signed-off-by: Cristian Le <git@lecris.dev>
1 parent fa55b7e commit 4af08c0

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

packit_service/events/github/push.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def __init__(
1515
project_url: str,
1616
commit_sha: str,
1717
commit_sha_before: str,
18+
commits: list[str],
1819
):
1920
super().__init__(project_url=project_url)
2021
self.repo_namespace = repo_namespace
@@ -23,6 +24,7 @@ def __init__(
2324
self.commit_sha = commit_sha
2425
self.commit_sha_before = commit_sha_before
2526
self.identifier = git_ref
27+
self.commits = commits
2628

2729
@classmethod
2830
def event_type(cls) -> str:

packit_service/events/gitlab/push.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def __init__(
1717
project_url: str,
1818
commit_sha: str,
1919
commit_sha_before: str,
20+
commits: list[str],
2021
):
2122
super().__init__(project_url=project_url)
2223
self.repo_namespace = repo_namespace
@@ -25,6 +26,7 @@ def __init__(
2526
self.commit_sha = commit_sha
2627
self.commit_sha_before = commit_sha_before
2728
self.identifier = git_ref
29+
self.commits = commits
2830

2931
@classmethod
3032
def event_type(cls) -> str:

packit_service/worker/parser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class _GitlabCommonData:
6666
ref: str
6767
head_commit: dict
6868
commit_sha_before: str
69+
commits: list[str]
6970

7071
@property
7172
def commit_sha(self) -> str:
@@ -455,6 +456,7 @@ def get_gitlab_push_common_data(event) -> _GitlabCommonData:
455456
ref=ref,
456457
head_commit=head_commit,
457458
commit_sha_before=before,
459+
commits=[commit["id"] for commit in commits],
458460
)
459461

460462
@staticmethod
@@ -515,6 +517,7 @@ def parse_gitlab_push_event(event) -> Optional[gitlab.push.Commit]:
515517
project_url=data.project_url,
516518
commit_sha=data.commit_sha,
517519
commit_sha_before=data.commit_sha_before,
520+
commits=data.commits,
518521
)
519522

520523
@staticmethod
@@ -568,6 +571,7 @@ def parse_github_push_event(event) -> Optional[github.push.Commit]:
568571
project_url=repo_url,
569572
commit_sha=head_commit,
570573
commit_sha_before=before,
574+
commits=[commit["id"] for commit in event.get("commits")],
571575
)
572576

573577
@staticmethod

0 commit comments

Comments
 (0)