diff --git a/.eslintrc.yml b/.eslintrc.yml index af54bd1..0445ffd 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,6 +1,8 @@ env: node: true extends: "eslint-config-eslint" +parserOptions: + ecmaVersion: 2021 rules: no-console: 0 require-unicode-regexp: 0 diff --git a/lib/release-ops.js b/lib/release-ops.js index c843e76..feccfc3 100644 --- a/lib/release-ops.js +++ b/lib/release-ops.js @@ -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})/, @@ -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; } @@ -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; diff --git a/tests/lib/release-ops.js b/tests/lib/release-ops.js index 4526726..258ab5f 100644 --- a/tests/lib/release-ops.js +++ b/tests/lib/release-ops.js @@ -179,7 +179,7 @@ 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.", @@ -187,6 +187,8 @@ describe("ReleaseOps", () => { "* 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)",