Skip to content

Commit

Permalink
Fix: Omit sponsors sync from changelog (#53)
Browse files Browse the repository at this point in the history
* Fix: Make npm install work

* Fix: Omit Sponsors Syncs from changelog (fixes #50)

* Update .eslintrc.yml

Co-authored-by: 薛定谔的猫 <[email protected]>

Co-authored-by: 薛定谔的猫 <[email protected]>
  • Loading branch information
nzakas and aladdin-add authored Apr 29, 2021
1 parent a968dff commit 397557b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
env:
node: true
extends: "eslint-config-eslint"
parserOptions:
ecmaVersion: 2021
rules:
no-console: 0
require-unicode-regexp: 0
Expand Down
6 changes: 4 additions & 2 deletions lib/release-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function parseLogs(logs) {
* @param {Object[]} logs An array of parsed commit log messages.
* @returns {Object[]} An array of parsed commit log messages.
*/
function excludeReverts(logs) {
function excludeRevertsAndSponsorSyncs(logs) {
const newLogs = logs.slice();

const revertRegex = /This reverts commit ([0-9a-f]{40})/,
Expand All @@ -178,6 +178,8 @@ function excludeReverts(logs) {
newLogs[shaIndexMap[sha]] = null;
newLogs[i] = null;
}
} else if (/^Sponsors: Sync/.test(log.title)) {
newLogs[i] = null;
} else {
shaIndexMap[log.sha] = i;
}
Expand All @@ -197,7 +199,7 @@ function excludeReverts(logs) {
*/
function calculateReleaseFromGitLogs(currentVersion, logs, prereleaseId) {

const excludedLogs = excludeReverts(parseLogs(logs));
const excludedLogs = excludeRevertsAndSponsorSyncs(parseLogs(logs));

const changelog = {},
repository = getPackageInfo().repository;
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/release-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,16 @@ describe("ReleaseOps", () => {
});
});

it("should disregard reverted commits", () => {
it("should disregard reverted commits and sponsor syncs", () => {
const logs = [
"* 34d6f550b2c87e61a70cb201abd3eadebb370453 Docs: Update something in the docs (githubhandle)",
"This is the body.",
"It has multiple lines.",
"* 5c5c361cc338d284cac6d170ab7e105e213e1307 Revert \"Breaking: A breaking change (fixes #1234)\" (Committer Name)",
"This reverts commit 00a3526f3a6560e4f91d390725b9a70f5d974f89.",
"This explains why.",
"* bcdc618488d12184e32a7ba170b443450c3e9e4a Sponsors: Sync README with website (Abc D. Efg)",
"Describe the bug.",
"* bcdc618488d12184e32a7ba170b443450c3e9e48 Fix: Fix a bug (fixes #4321) (Abc D. Efg)",
"Describe the bug.",
"* 7e4ffad5c91e4f8a99a95955ec65c5dbe9ae1758 Revert \"New: Add cool new feature (fixes #42)\" (Tina Tester)",
Expand Down

0 comments on commit 397557b

Please sign in to comment.