Merge pull request #2997 from thelounge/astorije/changelog-renovate-user
Do not report the (renamed) Renovate bot as a contributor
This commit is contained in:
commit
314a6346c6
@ -227,6 +227,7 @@ class RepositoryFetcher {
|
|||||||
repository(owner: "thelounge", name: $repositoryName) {
|
repository(owner: "thelounge", name: $repositoryName) {
|
||||||
ref(qualifiedName: $tag) {
|
ref(qualifiedName: $tag) {
|
||||||
tag: target {
|
tag: target {
|
||||||
|
oid
|
||||||
... on Tag {
|
... on Tag {
|
||||||
commit: target {
|
commit: target {
|
||||||
oid
|
oid
|
||||||
@ -237,7 +238,7 @@ class RepositoryFetcher {
|
|||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
const data = await this.fetch(tagQuery, {tag});
|
const data = await this.fetch(tagQuery, {tag});
|
||||||
return data.repository.ref.tag.commit;
|
return data.repository.ref.tag.commit || data.repository.ref.tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an array of annotated commits that have been made on the master
|
// Returns an array of annotated commits that have been made on the master
|
||||||
@ -255,6 +256,7 @@ class RepositoryFetcher {
|
|||||||
endCursor
|
endCursor
|
||||||
}
|
}
|
||||||
commits: nodes {
|
commits: nodes {
|
||||||
|
__typename
|
||||||
oid
|
oid
|
||||||
abbreviatedOid
|
abbreviatedOid
|
||||||
messageHeadline
|
messageHeadline
|
||||||
@ -297,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) {
|
||||||
@ -377,9 +377,11 @@ class RepositoryFetcher {
|
|||||||
repository(owner: "thelounge", name: $repositoryName) {
|
repository(owner: "thelounge", name: $repositoryName) {
|
||||||
${numbers.map((number) => `
|
${numbers.map((number) => `
|
||||||
PR${number}: pullRequest(number: ${number}) {
|
PR${number}: pullRequest(number: ${number}) {
|
||||||
|
__typename
|
||||||
title
|
title
|
||||||
url
|
url
|
||||||
author {
|
author {
|
||||||
|
__typename
|
||||||
login
|
login
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
@ -456,7 +458,7 @@ function printAuthorLink({login, url}) {
|
|||||||
|
|
||||||
// Builds a Markdown link for a given pull request or commit object
|
// Builds a Markdown link for a given pull request or commit object
|
||||||
function printEntryLink(entry) {
|
function printEntryLink(entry) {
|
||||||
const label = entry.title
|
const label = entry.__typename === "PullRequest"
|
||||||
? `#${entry.number}`
|
? `#${entry.number}`
|
||||||
: `\`${entry.abbreviatedOid}\``;
|
: `\`${entry.abbreviatedOid}\``;
|
||||||
|
|
||||||
@ -465,7 +467,7 @@ function printEntryLink(entry) {
|
|||||||
|
|
||||||
// Builds a Markdown entry list item depending on its type
|
// Builds a Markdown entry list item depending on its type
|
||||||
function printLine(entry) {
|
function printLine(entry) {
|
||||||
if (entry.title) {
|
if (entry.__typename === "PullRequest") {
|
||||||
return printPullRequest(entry);
|
return printPullRequest(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,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
|
||||||
@ -549,7 +551,7 @@ function hasAnnotatedComment(comments, expected) {
|
|||||||
|
|
||||||
function isSkipped(entry) {
|
function isSkipped(entry) {
|
||||||
return (
|
return (
|
||||||
(entry.messageHeadline && (
|
(entry.__typename === "Commit" && (
|
||||||
// Version bump commits created by `yarn version`
|
// Version bump commits created by `yarn version`
|
||||||
isValidVersion(entry.messageHeadline) ||
|
isValidVersion(entry.messageHeadline) ||
|
||||||
// Commit message suggested by this script
|
// Commit message suggested by this script
|
||||||
@ -687,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 !== "greenkeeper" && pullRequest.author.login !== "renovate-bot") {
|
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