Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

fix: align formatting of release notes with semantic release #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions src/compose.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import * as config from './config';
import { ICommitData } from './types';

const listSeperator = '* ';

export function previewFromCommits(commitsData: ICommitData): string {
if (commitsData.feat.length === 0 && commitsData.fix.length === 0) {
return '';
}

let title = '**Expected release notes';
if (config.GITHUB_PR_USERNAME) {
title += ` (by @${config.GITHUB_PR_USERNAME})`;
title += ` (by @${config.GITHUB_PR_USERNAME})`;
}
title += '**';

let body = '';
if (commitsData.feat.length > 0) {
body += '\n_features_:\n' + commitsData.feat.join('\n') + '\n';
body += '\n_Features_:\n' + commitsData.feat.join(listSeperator) + '\n';
}
if (commitsData.fix.length > 0) {
body += '\n_fixes_:\n' + commitsData.fix.join('\n') + '\n';
body += '\n_Fixes_:\n' + commitsData.fix.join(listSeperator) + '\n';
}
if (commitsData.others.length > 0) {
body += '\n_others (will not be included in Semantic-Release notes)_:\n' + commitsData.others.join('\n');
body += '\n_Others (will not be included in Semantic-Release notes)_:\n' + commitsData.others.join(listSeperator);
}

// TODO probably make this configurable
Expand Down