From 7c0bbf1c01ba806ea0c92e0248272aa170cd1322 Mon Sep 17 00:00:00 2001 From: dhrumit parmar Date: Mon, 8 Apr 2024 15:48:43 +0530 Subject: [PATCH] commit array storing --- scraper/src/github.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/scraper/src/github.py b/scraper/src/github.py index d9c65cb2..bd05bfac 100755 --- a/scraper/src/github.py +++ b/scraper/src/github.py @@ -176,19 +176,25 @@ def parse_event(self, event, event_time): reponame = event["repo"]["name"].split('/')[-1] branch = event["payload"]["ref"].split('/')[-1] commits = event["payload"]["commits"] - defaultBranchName = self.get_default_banch(repoOwner, reponame) + # defaultBranchName = self.get_default_banch(repoOwner, reponame) + all_commits = [] for commit in commits: - self.append( - user, - { - "type": "commit_direct", - "time": event_time, + commit_data = { "title": f'{event["repo"]["name"]}#{commit["sha"]}', "link": commit["url"], "text": commit["message"], - "branch": f'{branch} (default)' if branch == defaultBranchName else branch, - }, - ) + } + all_commits.append(commit_data) # Append commit data to the array + print(all_commits) + self.append( + user, + { + "type": "commit_direct", + "time": event_time, + "title": f'Pushed({len(commits)}) to {event["repo"]["name"]}({branch})', + "commits": all_commits, + }, + ) def add_collaborations(self, event, event_time): collaborators = set()