docs: update contributors listing
This commit is contained in:
parent
a1e1226977
commit
fc0a898a6a
20
.github/contributors/generate.ts
vendored
20
.github/contributors/generate.ts
vendored
@ -14,23 +14,27 @@ type Contribution = {
|
||||
}
|
||||
|
||||
const buildWeights = (contributors: any): Map<string, number> => {
|
||||
console.info(contributors)
|
||||
const loginToTotalWeight: Map<string, number> = new Map<string, number>()
|
||||
|
||||
const addContributions = (weight: number, contributions: Contribution[]) => {
|
||||
const addContributions = (weight: number, contributions: Contribution[], onlyExisting: boolean) => {
|
||||
for (const contr of contributions) {
|
||||
if (onlyExisting && !loginToTotalWeight.has(contr.login)) {
|
||||
continue
|
||||
}
|
||||
loginToTotalWeight.set(contr.login, (loginToTotalWeight.get(contr.login) || 0) + contr.count * weight)
|
||||
}
|
||||
}
|
||||
|
||||
// totally every pull or commit should account as 10
|
||||
addContributions(5, contributors.prCreators)
|
||||
addContributions(5, contributors.commitAuthors) // some commits are out pull requests
|
||||
addContributions(5, contributors.prCreators, false)
|
||||
addContributions(5, contributors.commitAuthors, false) // some commits are out pull requests
|
||||
|
||||
addContributions(2, contributors.prCommentators)
|
||||
addContributions(2, contributors.issueCreators)
|
||||
addContributions(2, contributors.issueCommentators)
|
||||
addContributions(2, contributors.reviewers)
|
||||
addContributions(0.3, contributors.reactors)
|
||||
addContributions(2, contributors.prCommentators, true)
|
||||
addContributions(2, contributors.issueCreators, true)
|
||||
addContributions(2, contributors.issueCommentators, true)
|
||||
addContributions(2, contributors.reviewers, true)
|
||||
addContributions(0.3, contributors.reactors, true)
|
||||
|
||||
return loginToTotalWeight
|
||||
}
|
||||
|
4
.github/contributors/rewrite_readme.ts
vendored
4
.github/contributors/rewrite_readme.ts
vendored
@ -28,7 +28,7 @@ const rowsVisible = 5
|
||||
const buildContributorsTable = (contributors: ContributorInfo[]): string => {
|
||||
type Contributors = ContributorInfo[]
|
||||
const rows: Contributors[] = []
|
||||
for (let i = 0; i < contributors.length; i++) {
|
||||
for (let i = 0; i < contributors.length; ) {
|
||||
rows.push(contributors.slice(i, i + colPerRow))
|
||||
i += colPerRow
|
||||
}
|
||||
@ -43,7 +43,7 @@ ${rows
|
||||
` <td align="center"><a href="${
|
||||
c.websiteUrl ? c.websiteUrl : `https://github.com/${c.login}`
|
||||
}?utm_source=golangci-lint-contributors"><img src="${c.avatarUrl}" width="100px;" alt=""/><br /><sub><b>${
|
||||
c.name
|
||||
c.name ? c.name : `@${c.login}`
|
||||
}</b></sub></a></td>`
|
||||
)
|
||||
.join(`\n`)}\n</tr>`
|
||||
|
Loading…
x
Reference in New Issue
Block a user