diff --git a/components/contributors/GithubActivity.tsx b/components/contributors/GithubActivity.tsx
index d2fe1830..ef4d1273 100644
--- a/components/contributors/GithubActivity.tsx
+++ b/components/contributors/GithubActivity.tsx
@@ -8,6 +8,7 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation";
import RelativeTime from "../RelativeTime";
import DateRangePicker from "../DateRangePicker";
import { format } from "date-fns";
+import Link from "next/link";
let commentTypes = (activityEvent: string[]) => {
switch (activityEvent[0]) {
@@ -161,33 +162,34 @@ let renderText = (activity: Activity) => {
);
- case "commit_direct":
+ case "pushed_commits":
return (
- {"Direct Commit to "}
- {activity["branch"]}
- {" in "}
-
- {activity["link"].split("/").slice(3, 5).join("/")}
-
-
+ {activity.title}
- {" "}
-
+
-
-
- {activity["text"]}
-
-
+ {activity?.commits?.map((commit, index) => (
+
+
+
+ {index + 1}.
+ {" "}
+
+ {commit.text}
+
+
+
+ ))}
);
+
default:
return (
@@ -508,6 +510,7 @@ export const ActivityCheckbox = (props: {
pr_opened: "PR opened",
pr_reviewed: "Code Review",
commit_direct: "Direct Commit",
+ pushed_commits: "Pushed Commits",
}[props.type]
}
diff --git a/lib/api.ts b/lib/api.ts
index 106e4302..9a806528 100644
--- a/lib/api.ts
+++ b/lib/api.ts
@@ -19,7 +19,7 @@ const points = {
pr_merged: 7,
pr_collaborated: 2,
issue_closed: 0,
- commit_direct: 2,
+ pushed_commits: 0,
};
// Comments will get a single point
// Picking up an issue would get a point
@@ -27,7 +27,7 @@ const points = {
// Finding a bug would add up to 4 points
// Opening a PR would give a single point and merging it would give you the other 7 points, making 8 per PR
// Updating the EOD would get 2 points per day and additional 20 for regular daily updates plus 10 for just missing one
-// Push direct commmmit have two points
+// pushed commits directly to the repository would not be counted as of now
function formatSlug(slug: string) {
return slug.replace(/\.md$/, "");
}
diff --git a/lib/types.ts b/lib/types.ts
index d47d3c71..2b35b349 100644
--- a/lib/types.ts
+++ b/lib/types.ts
@@ -66,16 +66,21 @@ export const ACTIVITY_TYPES = [
"pr_opened",
"pr_merged",
"pr_collaborated",
- "commit_direct",
+ "pushed_commits",
] as const;
+export interface commit {
+ link: string;
+ text: string;
+}
+
export interface Activity {
type: (typeof ACTIVITY_TYPES)[number];
title: string;
time: string;
link: string;
text: string;
- branch?: string;
+ commits?: commit[];
collaborated_with?: string[];
turnaround_time?: number;
}
diff --git a/scraper/src/github.py b/scraper/src/github.py
index bd05bfac..6ae095c7 100755
--- a/scraper/src/github.py
+++ b/scraper/src/github.py
@@ -172,30 +172,37 @@ def parse_event(self, event, event_time):
)
elif event["type"] == "PushEvent":
- repoOwner = "coronasafe"
- reponame = event["repo"]["name"].split('/')[-1]
branch = event["payload"]["ref"].split('/')[-1]
commits = event["payload"]["commits"]
- # defaultBranchName = self.get_default_banch(repoOwner, reponame)
all_commits = []
+
+ # Iterate through each commit
for commit in commits:
+ # Fetch full commit details
+ commit_details = requests.get(commit["url"], headers=self.headers).json()
+
+ if len(commit_details.get("parents", [])) in [0, 1]:
+ # Prepare commit data
commit_data = {
- "title": f'{event["repo"]["name"]}#{commit["sha"]}',
- "link": commit["url"],
+ "link": commit_details["html_url"],
"text": commit["message"],
}
- all_commits.append(commit_data) # Append commit data to the array
- print(all_commits)
+ # Append commit data to the array
+ all_commits.append(commit_data)
+
+ # Append pushed commits event
self.append(
user,
{
- "type": "commit_direct",
+ "type": "pushed_commits",
"time": event_time,
- "title": f'Pushed({len(commits)}) to {event["repo"]["name"]}({branch})',
+ "title": f'Pushed({len(all_commits)}) commits to {event["repo"]["name"]}({branch})',
"commits": all_commits,
},
)
+
+
def add_collaborations(self, event, event_time):
collaborators = set()