2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-05 16:42:32 +03:00

chore(ci): fix automatic contributors resolving; (#5403)

This commit is contained in:
Dmitriy Mozgovoy
2022-12-23 16:49:47 +02:00
committed by GitHub
parent 341f735297
commit 8de391ff8a
3 changed files with 9 additions and 6 deletions
+6 -3
View File
@@ -19,7 +19,9 @@ const getUserInfo = ((userCache) => async (email) => {
return userCache[email];
}
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 ? {
...user,
@@ -52,14 +54,15 @@ const getReleaseInfo = async (version, useGithub) => {
for(const {author, email, insertions, deletions} of commits) {
const user = Object.assign({
name: author,
email
}, useGithub ? await getUserInfo(email) : null);
const entry = authors[author] = (authors[author] || {
const entry = authors[email] = (authors[email] || {
insertions: 0, deletions: 0, ...user
});
entry.displayName = entry.name || author || entry.login;
entry.github = entry.login ? `https://github.com/${encodeURIComponent(entry.login)}` : '';
entry.insertions += insertions;
+1 -1
View File
@@ -12,7 +12,7 @@ const injectContributors = async (infile, injector) => {
infile = path.resolve(__dirname, 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;
let tag;
+2 -2
View File
@@ -4,9 +4,9 @@
{{#each authors}}
{{#if github}}
- {{#if avatar_url}}![avatar]({{avatar_url_sm}}){{/if}} [{{name}}]({{github}}) ({{insertions}}++ / {{deletions}}--)
- {{#if avatar_url}}![avatar]({{avatar_url_sm}}){{/if}} [{{displayName}}]({{github}}) ({{insertions}}++ / {{deletions}}--)
{{else}}
- {{name}} ({{insertions}}++ / {{deletions}}--)
- {{displayName}} ({{insertions}}++ / {{deletions}}--)
{{/if}}
{{/each}}