Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 17 commits into from Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
3f2f496
chore(ci): Add release-it script;
DigitalBrainJS Dec 10, 2022
1bfc41b
Merge branch 'chore/release-it' into v1.x
DigitalBrainJS Dec 10, 2022
acaf0f4
Merge branch 'v1.x' of https://github.com/axios/axios into v1.x
DigitalBrainJS Dec 15, 2022
8a5de86
Merge branch 'v1.x' of https://github.com/axios/axios into v1.x
DigitalBrainJS Dec 15, 2022
cff9271
Merge branch 'v1.x' of https://github.com/axios/axios into v1.x
DigitalBrainJS Dec 17, 2022
67afe20
Merge branch 'v1.x' of https://github.com/axios/axios into v1.x
DigitalBrainJS Dec 19, 2022
5098f4e
fix(utils): redesigned logic for obtaining the global link;;
DigitalBrainJS Dec 19, 2022
502b45e
chore(git): updated .gitignore;
DigitalBrainJS Dec 19, 2022
6a00117
chore(git): fix husky prepare script;
DigitalBrainJS Dec 19, 2022
e348973
Merge branch 'v1.x' of https://github.com/axios/axios into fix/ci
DigitalBrainJS Dec 19, 2022
4ac677a
chore(github): reworked npm release action step;
DigitalBrainJS Dec 20, 2022
3422dbb
chore(ci): add CHANGELOG.md contributors section generator;
DigitalBrainJS Dec 20, 2022
d42e790
chore(deps): add `auto-changelog` to package.json;
DigitalBrainJS Dec 20, 2022
1358105
chore(ci): improved logging for contributors section generator;
DigitalBrainJS Dec 20, 2022
8134adb
Merge branch 'v1.x' of https://github.com/axios/axios into fix/ci
DigitalBrainJS Dec 20, 2022
ef8e403
chore(changelog): fix automatic contributors resolving;
DigitalBrainJS Dec 23, 2022
0b8a5ab
Merge branch 'v1.x' into fix/ci
DigitalBrainJS Dec 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions bin/contributors.js
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion bin/injectContributorsList.js
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions templates/contributors.hbs
Expand Up @@ -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}}

Expand Down