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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(python): standardize Python headers in the changelog #1390

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/strategies/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import {
} from '../updaters/python/pyproject-toml';
import {logger} from '../util/logger';
import {PythonFileWithVersion} from '../updaters/python/python-file-with-version';
import {ConventionalCommit, Commit} from '../commit';
import {Release} from '../release';
import {TagName} from '../util/tag-name';

const CHANGELOG_SECTIONS = [
{type: 'feat', section: 'Features'},
Expand Down Expand Up @@ -154,4 +157,27 @@ export class Python extends BaseStrategy {
protected initialReleaseVersion(): Version {
return Version.parse('0.1.0');
}

protected async buildReleaseNotes(
conventionalCommits: ConventionalCommit[],
newVersion: Version,
newVersionTag: TagName,
latestRelease?: Release,
commits?: Commit[]
): Promise<string> {
const releaseNotes = await super.buildReleaseNotes(
conventionalCommits,
newVersion,
newVersionTag,
latestRelease,
commits
);
return (
releaseNotes
// Remove links in version title line and standardize on h2
.replace(/^###? \[([\d.]+)\]\([^)]*\)/gm, '## $1')
chingor13 marked this conversation as resolved.
Show resolved Hide resolved
// Standardize on h3 for change type subheaders
.replace(/^###? (Features|Bug Fixes|Documentation)$/gm, '### $1')
);
}
}