diff --git a/components/contributors/GithubActivity.tsx b/components/contributors/GithubActivity.tsx index ef4d1273..6bfdb807 100644 --- a/components/contributors/GithubActivity.tsx +++ b/components/contributors/GithubActivity.tsx @@ -167,7 +167,8 @@ let renderText = (activity: Activity) => {

- {activity.title} + pushed({activity?.commits?.length}) commits to {activity.branch}{" "} + in {activity.repo}{" "} @@ -176,12 +177,14 @@ let renderText = (activity: Activity) => {

{activity?.commits?.map((commit, index) => (
- - - {index + 1}. - {" "} + + {commit.sha} - {commit.text} + {commit.text.split("\n")[0]}
diff --git a/lib/types.ts b/lib/types.ts index 2b35b349..dd58a156 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -69,9 +69,10 @@ export const ACTIVITY_TYPES = [ "pushed_commits", ] as const; -export interface commit { +export interface Commit { link: string; text: string; + sha: string; } export interface Activity { @@ -80,7 +81,9 @@ export interface Activity { time: string; link: string; text: string; - commits?: commit[]; + branch?: string; + repo?: string; + commits?: Commit[]; collaborated_with?: string[]; turnaround_time?: number; } diff --git a/scraper/src/github.py b/scraper/src/github.py index 6ae095c7..4776a8a9 100755 --- a/scraper/src/github.py +++ b/scraper/src/github.py @@ -181,11 +181,12 @@ def parse_event(self, event, event_time): # Fetch full commit details commit_details = requests.get(commit["url"], headers=self.headers).json() - if len(commit_details.get("parents", [])) in [0, 1]: + if len(commit_details.get("parents", [])) < 2: # Prepare commit data commit_data = { "link": commit_details["html_url"], "text": commit["message"], + "sha" : commit["sha"][-7:], } # Append commit data to the array all_commits.append(commit_data) @@ -196,7 +197,9 @@ def parse_event(self, event, event_time): { "type": "pushed_commits", "time": event_time, - "title": f'Pushed({len(all_commits)}) commits to {event["repo"]["name"]}({branch})', + # "title": f'Pushed({len(all_commits)}) commits to {event["repo"]["name"]}({branch})', + "repo": event["repo"]["name"], + "branch": branch, "commits": all_commits, }, )