Skip to content

build: Add yarn changelog command #7016

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

Merged
merged 1 commit into from
Feb 1, 2023
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
3 changes: 1 addition & 2 deletions docs/publishing-a-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ _These steps are only relevant to Sentry employees when preparing and publishing
## Updating the Changelog

1. Create a new branch.
2. Run `git log --format="- %s"` and copy everything since the last release.
2. Run `yarn changelog` and copy everything
3. Create a new section in the changelog, deciding based on the changes whether it should be a minor bump or a patch release.
4. Paste in the logs you copied earlier.
5. Delete any which aren't user-facing changes.
6. Alphabetize the rest.
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!)
8. Commit, push, and open a PR with the title `meta: Update changelog for <fill in relevant version here>` against `develop` branch.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"clean:all": "run-p clean:build clean:caches clean:deps",
"codecov": "codecov",
"fix": "lerna run fix",
"changelog": "ts-node ./scripts/get-commit-list.ts",
"link:yarn": "lerna exec yarn link",
"lint": "lerna run lint",
"lint:eslint": "lerna run lint:eslint",
Expand Down
23 changes: 23 additions & 0 deletions scripts/get-commit-list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { execSync } from 'child_process';

function run(): void {
const commits = execSync('git log --format="- %s"').toString().split('\n');

const lastReleasePos = commits.findIndex(commit => commit.includes("Merge branch 'release"));

const newCommits = commits.splice(0, lastReleasePos).filter(commit => {
// Filter out master/develop merges
if (/Merge pull request #(\d+) from getsentry\/(master|develop)/.test(commit)) {
return false;
}

return true;
});

newCommits.sort((a, b) => a.localeCompare(b));

// eslint-disable-next-line no-console
console.log(newCommits.join('\n'));
}

run();