Improve discriminating bots from actual contributors in the list of PRs/commits
This commit is contained in:
parent
682207ffe6
commit
7c024864b2
@ -299,8 +299,6 @@ class RepositoryFetcher {
|
|||||||
const commits = await fetchPaginatedCommits();
|
const commits = await fetchPaginatedCommits();
|
||||||
|
|
||||||
commits.forEach((commit) => {
|
commits.forEach((commit) => {
|
||||||
commit.author = commit.author.user;
|
|
||||||
|
|
||||||
const resultPR = /^Merge pull request #([0-9]+) .+/.exec(commit.messageHeadline);
|
const resultPR = /^Merge pull request #([0-9]+) .+/.exec(commit.messageHeadline);
|
||||||
|
|
||||||
if (resultPR) {
|
if (resultPR) {
|
||||||
@ -383,6 +381,7 @@ class RepositoryFetcher {
|
|||||||
title
|
title
|
||||||
url
|
url
|
||||||
author {
|
author {
|
||||||
|
__typename
|
||||||
login
|
login
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
@ -482,7 +481,7 @@ function printPullRequest(pullRequest) {
|
|||||||
|
|
||||||
// Builds a Markdown list item for a commit made directly in `master`
|
// Builds a Markdown list item for a commit made directly in `master`
|
||||||
function printCommit(commit) {
|
function printCommit(commit) {
|
||||||
return `- ${commit.messageHeadline} (${printEntryLink(commit)} ${printAuthorLink(commit.author)})`;
|
return `- ${commit.messageHeadline} (${printEntryLink(commit)} ${printAuthorLink(commit.author.user)})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builds a Markdown list of all given items
|
// Builds a Markdown list of all given items
|
||||||
@ -690,9 +689,13 @@ function dedupeEntries(changelog, items) {
|
|||||||
// Given a list of entries (pull requests, commits), retrieves GitHub usernames
|
// Given a list of entries (pull requests, commits), retrieves GitHub usernames
|
||||||
// (with format `@username`) of everyone who contributed to this version.
|
// (with format `@username`) of everyone who contributed to this version.
|
||||||
function extractContributors(entries) {
|
function extractContributors(entries) {
|
||||||
const set = Object.values(entries).reduce((memo, pullRequest) => {
|
const set = Object.values(entries).reduce((memo, {__typename, author}) => {
|
||||||
if (pullRequest.author.login !== "renovate") {
|
if (__typename === "PullRequest" && author.__typename !== "Bot") {
|
||||||
memo.add("@" + pullRequest.author.login);
|
memo.add("@" + author.login);
|
||||||
|
// Commit authors are *always* of type "User", so have to discriminate some
|
||||||
|
// other way. Making the assumption of a suffix for now, see how that goes.
|
||||||
|
} else if (__typename === "Commit" && !author.user.login.endsWith("-bot")) {
|
||||||
|
memo.add("@" + author.user.login);
|
||||||
}
|
}
|
||||||
|
|
||||||
return memo;
|
return memo;
|
||||||
|
Loading…
Reference in New Issue
Block a user