Skip to content

Commit

Permalink
fix: include contribution types in commit message (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenshiAMD authored Sep 23, 2022
1 parent 89dbc86 commit 0839201
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 6 additions & 1 deletion lib/add-contributor.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,15 @@ async function addContributor({
originalSha: config.getOriginalSha(),
};

const contributionsTitlePartLimit = 3
const arr = contributions.slice(0, contributionsTitlePartLimit);
if (arr.length > contributionsTitlePartLimit) arr[arr.length - 1] = `${contributions.length - 2} more`
const contributionsTitlePartText = arr.slice(0, arr.length - 1).join(', ') + ", and " + arr.slice(-1);

const convention = config.get().commitConvention;
const prTitle = convertMessage({
tag: "docs",
msg: `add ${who} as a contributor`,
msg: `add ${who} as a contributor for ${contributionsTitlePartText}`,
convention
});

Expand Down
12 changes: 6 additions & 6 deletions test/integration/__snapshots__/issue_comment.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ Object {
This was requested by jakebolam [in this comment](https://github.com/all-contributors/all-contributors-bot/pull/1#issuecomment-453012966)",
"head": "all-contributors/add-jakebolam",
"maintainer_can_modify": true,
"title": "add jakebolam as a contributor",
"title": "add jakebolam as a contributor for code, doc, and infra",
}
`;
Expand Down Expand Up @@ -513,7 +513,7 @@ Object {
This was requested by jakebolam [in this comment](https://github.com/all-contributors/all-contributors-bot/pull/1#issuecomment-453012966)",
"head": "all-contributors/add-jakebolam",
"maintainer_can_modify": true,
"title": "add jakebolam as a contributor",
"title": "add jakebolam as a contributor for code, doc, and infra",
}
`;
Expand Down Expand Up @@ -588,7 +588,7 @@ Object {
This was requested by jakebolam [in this comment](https://github.com/all-contributors/all-contributors-bot/pull/1#issuecomment-453012966)",
"head": "all-contributors/add-jakebolam",
"maintainer_can_modify": true,
"title": "docs: add jakebolam as a contributor",
"title": "docs: add jakebolam as a contributor for code, doc, and infra",
}
`;
Expand Down Expand Up @@ -664,7 +664,7 @@ Object {
This was requested by jakebolam [in this comment](https://github.com/all-contributors/all-contributors-bot/pull/1#issuecomment-453012966)",
"head": "all-contributors/add-jakebolam",
"maintainer_can_modify": true,
"title": "add jakebolam as a contributor",
"title": "add jakebolam as a contributor for code, doc, and infra",
}
`;
Expand Down Expand Up @@ -772,7 +772,7 @@ Object {
This was requested by jakebolam [in this comment](https://github.com/all-contributors/all-contributors-bot/pull/1#issuecomment-453012966)",
"head": "all-contributors/add-jakebolam",
"maintainer_can_modify": true,
"title": "add jakebolam as a contributor",
"title": "add jakebolam as a contributor for code, doc, and infra",
}
`;
Expand Down Expand Up @@ -869,7 +869,7 @@ Object {
This was requested by jakebolam [in this comment](https://github.com/all-contributors/all-contributors-bot/pull/1#issuecomment-453012966)",
"head": "all-contributors/add-jakebolam",
"maintainer_can_modify": true,
"title": "add jakebolam as a contributor",
"title": "add jakebolam as a contributor for code, doc, and infra",
}
`;
Expand Down

1 comment on commit 0839201

@vercel
Copy link

@vercel vercel bot commented on 0839201 Sep 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.