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:
+6
-3
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
{{#each authors}}
|
||||
{{#if github}}
|
||||
- {{#if avatar_url}}{{/if}} [{{name}}]({{github}}) ({{insertions}}++ / {{deletions}}--)
|
||||
- {{#if avatar_url}}{{/if}} [{{displayName}}]({{github}}) ({{insertions}}++ / {{deletions}}--)
|
||||
{{else}}
|
||||
- {{name}} ({{insertions}}++ / {{deletions}}--)
|
||||
- {{displayName}} ({{insertions}}++ / {{deletions}}--)
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user