Skip to content

Commit

Permalink
build: Add yarn changelog command (getsentry#7016)
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea authored Feb 1, 2023
1 parent b9a004f commit 8c0d918
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
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();

0 comments on commit 8c0d918

Please sign in to comment.