Skip to content

Commit 8c0d918

Browse files
authored
build: Add yarn changelog command (#7016)
1 parent b9a004f commit 8c0d918

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

docs/publishing-a-release.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ _These steps are only relevant to Sentry employees when preparing and publishing
1717
## Updating the Changelog
1818

1919
1. Create a new branch.
20-
2. Run `git log --format="- %s"` and copy everything since the last release.
20+
2. Run `yarn changelog` and copy everything
2121
3. Create a new section in the changelog, deciding based on the changes whether it should be a minor bump or a patch release.
2222
4. Paste in the logs you copied earlier.
2323
5. Delete any which aren't user-facing changes.
24-
6. Alphabetize the rest.
2524
7. If any of the PRs are from external contributors, include underneath the commits `Work in this release contributed by <list of external contributors' GitHub usernames>. Thank you for your contributions!`. If there's only one external PR, don't forget to remove the final `s`. If there are three or more, use an Oxford comma. (It's in the Sentry styleguide!)
2625
8. Commit, push, and open a PR with the title `meta: Update changelog for <fill in relevant version here>` against `develop` branch.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"clean:all": "run-p clean:build clean:caches clean:deps",
2020
"codecov": "codecov",
2121
"fix": "lerna run fix",
22+
"changelog": "ts-node ./scripts/get-commit-list.ts",
2223
"link:yarn": "lerna exec yarn link",
2324
"lint": "lerna run lint",
2425
"lint:eslint": "lerna run lint:eslint",

scripts/get-commit-list.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { execSync } from 'child_process';
2+
3+
function run(): void {
4+
const commits = execSync('git log --format="- %s"').toString().split('\n');
5+
6+
const lastReleasePos = commits.findIndex(commit => commit.includes("Merge branch 'release"));
7+
8+
const newCommits = commits.splice(0, lastReleasePos).filter(commit => {
9+
// Filter out master/develop merges
10+
if (/Merge pull request #(\d+) from getsentry\/(master|develop)/.test(commit)) {
11+
return false;
12+
}
13+
14+
return true;
15+
});
16+
17+
newCommits.sort((a, b) => a.localeCompare(b));
18+
19+
// eslint-disable-next-line no-console
20+
console.log(newCommits.join('\n'));
21+
}
22+
23+
run();

0 commit comments

Comments
 (0)