mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
meta: remove AUTHORS file
The AUTHORS file does not serve any significant practical purpose and is a bit of a maintenance annoyance. Let's remove it. PR-URL: https://github.com/nodejs/node/pull/46845 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Nitzan Uziely <linkgoron@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
1 parent
8aca3cf410
commit
b199acd95c
3 files changed
-3766
No files matched your search
@@ -1,39 +0,0 @@
|
||||
name: Authors update
|
||||
on:
|
||||
schedule:
|
||||
# Run once a week at 00:05 AM UTC on Sunday.
|
||||
- cron: 5 0 * * 0
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
authors_update:
|
||||
if: github.repository == 'nodejs/node'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: '0' # This is required to actually get all the authors
|
||||
persist-credentials: false
|
||||
- run: tools/update-authors.mjs # Run the AUTHORS tool
|
||||
- uses: gr2m/create-or-update-pull-request-action@77596e3166f328b24613f7082ab30bf2d93079d5
|
||||
# Creates a PR or update the Action's existing PR, or
|
||||
# no-op if the base branch is already up-to-date.
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
|
||||
with:
|
||||
author: Node.js GitHub Bot <github-bot@iojs.org>
|
||||
body: >
|
||||
Here are some new additions to the AUTHORS file.
|
||||
This is an automatically generated PR by the
|
||||
`authors.yml` GitHub Action, which runs `tools/update-authors.mjs`.
|
||||
Check the output of
|
||||
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
for possible duplicates.
|
||||
branch: actions/authors-update # Custom branch *just* for this Action.
|
||||
commit-message: 'meta: update AUTHORS'
|
||||
labels: meta
|
||||
title: 'meta: update AUTHORS'
|
||||
@@ -1,112 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
// Usage: tools/update-authors.mjs [--dry]
|
||||
// Passing --dry will redirect output to stdout rather than write to 'AUTHORS'.
|
||||
import { spawn } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import readline from 'node:readline';
|
||||
|
||||
class CaseIndifferentMap {
|
||||
_map = new Map();
|
||||
|
||||
get(key) { return this._map.get(key.toLowerCase()); }
|
||||
has(key) { return this._map.has(key.toLowerCase()); }
|
||||
set(key, value) { return this._map.set(key.toLowerCase(), value); }
|
||||
}
|
||||
|
||||
const log = spawn(
|
||||
'git',
|
||||
// Inspect author name/email and body.
|
||||
['log', '--reverse', '--format=Author: %aN <%aE>\n%b'], {
|
||||
stdio: ['inherit', 'pipe', 'inherit'],
|
||||
});
|
||||
const rl = readline.createInterface({ input: log.stdout });
|
||||
|
||||
let output;
|
||||
if (process.argv.includes('--dry'))
|
||||
output = process.stdout;
|
||||
else
|
||||
output = fs.createWriteStream('AUTHORS');
|
||||
|
||||
output.write('# Authors ordered by first contribution.\n\n');
|
||||
|
||||
const mailmap = new CaseIndifferentMap();
|
||||
{
|
||||
const lines = fs.readFileSync(new URL('../.mailmap', import.meta.url),
|
||||
{ encoding: 'utf8' }).split('\n');
|
||||
for (let line of lines) {
|
||||
line = line.trim();
|
||||
if (line.startsWith('#') || line === '') continue;
|
||||
|
||||
const match = line.match(/^(?:([^<]+)\s+)?(?:(<[^>]+>)\s+)?(?:([^<]+)\s+)?(<[^>]+>)$/);
|
||||
if (match) {
|
||||
const [, replaceName, replaceEmail, originalName, originalEmail] = match;
|
||||
const key = originalName ? `${originalName}\0${originalEmail.toLocaleLowerCase()}` : originalEmail.toLowerCase();
|
||||
mailmap.set(key, {
|
||||
author: replaceName || originalName,
|
||||
email: replaceEmail || originalEmail,
|
||||
});
|
||||
} else {
|
||||
console.warn('Unknown .mailmap format:', line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const previousAuthors = new CaseIndifferentMap();
|
||||
{
|
||||
const lines = fs.readFileSync(new URL('../AUTHORS', import.meta.url),
|
||||
{ encoding: 'utf8' }).split('\n');
|
||||
for (let line of lines) {
|
||||
line = line.trim();
|
||||
if (line.startsWith('#') || line === '') continue;
|
||||
|
||||
const match = line.match(/^([^<]+)\s+(<[^>]+>)$/);
|
||||
if (match) {
|
||||
const name = match[1];
|
||||
const email = match[2];
|
||||
if (previousAuthors.has(name)) {
|
||||
const emails = previousAuthors.get(name);
|
||||
emails.push(email);
|
||||
} else {
|
||||
previousAuthors.set(name, [email]);
|
||||
}
|
||||
} else {
|
||||
console.warn('Unknown AUTHORS format:', line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const seen = new Set();
|
||||
|
||||
// Support regular git author metadata, as well as `Author:` and
|
||||
// `Co-authored-by:` in the message body. Both have been used in the past
|
||||
// to indicate multiple authors per commit, with the latter standardized
|
||||
// by GitHub now.
|
||||
const authorRe =
|
||||
/(^Author:|^Co-authored-by:)\s+(?<author>[^<]+)\s+(?<email><[^>]+>)/i;
|
||||
for await (const line of rl) {
|
||||
const match = line.match(authorRe);
|
||||
if (!match) continue;
|
||||
|
||||
let { author, email } = match.groups;
|
||||
const emailLower = email.toLowerCase();
|
||||
|
||||
const replacement =
|
||||
mailmap.get(author + '\0' + emailLower) || mailmap.get(emailLower);
|
||||
if (replacement) {
|
||||
({ author, email } = { author, email, ...replacement });
|
||||
}
|
||||
|
||||
if (seen.has(email)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
seen.add(email);
|
||||
output.write(`${author} ${email}\n`);
|
||||
const duplicate = previousAuthors.get(author);
|
||||
if (duplicate && !duplicate.includes(email)) {
|
||||
console.warn('Author name already in AUTHORS file. Possible duplicate:');
|
||||
console.warn(` ${author} ${email}`);
|
||||
}
|
||||
}
|
||||
|
||||
output.end('\n# Generated by tools/update-authors.mjs\n');
|
||||
Reference in new issue
Block a user