mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
chore(ci): fix automatic contributors resolving; (#5403)
This commit is contained in:
+6
-3
@@ -19,7 +19,9 @@ const getUserInfo = ((userCache) => async (email) => {
|
|||||||
return userCache[email];
|
return userCache[email];
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const {data: {items: [user]}} = await axios.get(`https://api.github.com/search/users?q=${email}`);
|
const tag = email.replace(/@users\.noreply\.github\.com/, '');
|
||||||
|
|
||||||
|
const {data: {items: [user]}} = await axios.get(`https://api.github.com/search/users?q=${tag}`);
|
||||||
|
|
||||||
return (userCache[email] = user ? {
|
return (userCache[email] = user ? {
|
||||||
...user,
|
...user,
|
||||||
@@ -52,14 +54,15 @@ const getReleaseInfo = async (version, useGithub) => {
|
|||||||
|
|
||||||
for(const {author, email, insertions, deletions} of commits) {
|
for(const {author, email, insertions, deletions} of commits) {
|
||||||
const user = Object.assign({
|
const user = Object.assign({
|
||||||
name: author,
|
|
||||||
email
|
email
|
||||||
}, useGithub ? await getUserInfo(email) : null);
|
}, useGithub ? await getUserInfo(email) : null);
|
||||||
|
|
||||||
const entry = authors[author] = (authors[author] || {
|
const entry = authors[email] = (authors[email] || {
|
||||||
insertions: 0, deletions: 0, ...user
|
insertions: 0, deletions: 0, ...user
|
||||||
});
|
});
|
||||||
|
|
||||||
|
entry.displayName = entry.name || author || entry.login;
|
||||||
|
|
||||||
entry.github = entry.login ? `https://github.com/${encodeURIComponent(entry.login)}` : '';
|
entry.github = entry.login ? `https://github.com/${encodeURIComponent(entry.login)}` : '';
|
||||||
|
|
||||||
entry.insertions += insertions;
|
entry.insertions += insertions;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const injectContributors = async (infile, injector) => {
|
|||||||
infile = path.resolve(__dirname, infile);
|
infile = path.resolve(__dirname, infile);
|
||||||
|
|
||||||
const content = String(await fs.readFile(infile));
|
const content = String(await fs.readFile(infile));
|
||||||
const headerRE = /^##\s+\[([-_\d.\w]+)]\s+-.+/mig;
|
const headerRE = /^#+\s+\[([-_\d.\w]+)].+?$/mig;
|
||||||
const contributorsRE = /^\s*### Contributors/mi;
|
const contributorsRE = /^\s*### Contributors/mi;
|
||||||
|
|
||||||
let tag;
|
let tag;
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
{{#each authors}}
|
{{#each authors}}
|
||||||
{{#if github}}
|
{{#if github}}
|
||||||
- {{#if avatar_url}}{{/if}} [{{name}}]({{github}}) ({{insertions}}++ / {{deletions}}--)
|
- {{#if avatar_url}}{{/if}} [{{displayName}}]({{github}}) ({{insertions}}++ / {{deletions}}--)
|
||||||
{{else}}
|
{{else}}
|
||||||
- {{name}} ({{insertions}}++ / {{deletions}}--)
|
- {{displayName}} ({{insertions}}++ / {{deletions}}--)
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user