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

Fix: Omit sponsors sync from changelog #53

Merged
merged 3 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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