From d17d24ef0f1dfdb8af644b23c6cc28c1f6215afb Mon Sep 17 00:00:00 2001
From: Holly Cummins
Date: Fri, 3 Nov 2023 11:18:46 +0000
Subject: [PATCH] Exclude merge commits
---
plugins/github-enricher/sponsorFinder.js | 10 +++++++++-
src/templates/extension-detail.js | 8 +++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/plugins/github-enricher/sponsorFinder.js b/plugins/github-enricher/sponsorFinder.js
index 9c5ab3b45877..c18c1b23ddd4 100644
--- a/plugins/github-enricher/sponsorFinder.js
+++ b/plugins/github-enricher/sponsorFinder.js
@@ -97,6 +97,10 @@ const getUserContributionsNoCache = async (org, project, inPath) => {
edges{
node{
... on Commit{
+ parents(first: 1) {
+ totalCount
+ }
+
author {
user {
login
@@ -121,7 +125,11 @@ const getUserContributionsNoCache = async (org, project, inPath) => {
const history = body?.data?.repository?.defaultBranchRef?.target?.history?.edges
if (history && Array.isArray(history)) {
- let users = history.map(o => o?.node?.author?.user)
+
+ // Filter out merge commits
+ const historyWithoutMerges = history.filter(o => o?.node?.parents?.totalCount === 1)
+
+ let users = historyWithoutMerges.map(o => o?.node?.author?.user)
// Some commits have an author who doesn't have a github mapping, so filter those out
users = users.filter(user => user !== null && user !== undefined)
diff --git a/src/templates/extension-detail.js b/src/templates/extension-detail.js
index 39cb72f0e7e6..b9eb99a6b149 100644
--- a/src/templates/extension-detail.js
+++ b/src/templates/extension-detail.js
@@ -248,13 +248,14 @@ const ExtensionDetailTemplate = ({
{metadata?.sourceControl?.contributors && metadata?.sourceControl?.contributors.length > 0 && (
- Recent Contributors
+
+ Recent Contributors
{!extensionRootUrl && (
- Commits to this extension's repository in the past six months (including merge commits).
)}
+ Commits to this extension's repository in the past six months (excluding merge commits).
)}
{extensionRootUrl && (
Commits to this extension's source code in the past six months
- (including merge commits).
)}
+ (excluding merge commits).
)}
@@ -271,6 +272,7 @@ const ExtensionDetailTemplate = ({
minute: "numeric"
})}.
)}
+
)
}