Skip to content

Commit

Permalink
fix(projects): fix when only one tag generate total changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Jun 6, 2023
1 parent e227fd4 commit 6b878e1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Changelog


## [v0.0.1](https://github.com/soybeanjs/changelog/compare/2681a2f0d5feedf38f5c1b4754202dca1976948d...v0.0.1) (2023-06-07)

###    📖 Documentation

- **projects**: add CHANGELOG.md &nbsp;-&nbsp; by @soybeanjs [<samp>(029ea)</samp>](https://github.com/soybeanjs/changelog/commit/029eaa7)

## [v0.0.1](https://github.com/soybeanjs/changelog/compare/...main) (23-06-07)

### &nbsp;&nbsp;&nbsp;📖 Documentation
### &nbsp;&nbsp;&nbsp;🏡 Chore

- **projects**: Add CHANGELOG.md &nbsp;-&nbsp; by @soybeanjs [<samp>(029ea)</samp>](https://github.com/soybeanjs/changelog/commit/029eaa7)
- **projects**: release v0.0.1 &nbsp;-&nbsp; by @soybeanjs [<samp>(e227f)</samp>](https://github.com/soybeanjs/changelog/commit/e227fd4)

### &nbsp;&nbsp;&nbsp;❤️ Contributors

Expand Down
4 changes: 2 additions & 2 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,13 @@ export async function getGitCommitsAndResolvedAuthors(
for await (const commit of commits) {
const resolvedAuthors: ResolvedAuthor[] = [];

for await (const [index, author] of Object.entries(commit.authors)) {
for await (const [index, author] of commit.authors.entries()) {
const { email, name } = author;

if (email && name) {
const commitHashes: string[] = [];

if (index === '0') {
if (index === 0) {
commitHashes.push(commit.shortHash);
}

Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export async function getTotalChangelogMarkdown(options?: Partial<ChangelogOptio

const tags = getFromToTags(opts.tags);

if (tags.length === 0) {
return getChangelogMarkdown(opts);
}

bar?.start(tags.length, 0);

let markdown = '';
Expand Down
2 changes: 1 addition & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function createDefaultOptions() {
to: '',
tags: [],
tagDateMap: new Map(),
capitalize: true,
capitalize: false,
emoji: true,
titles: {
breakingChanges: '🚨 Breaking Changes'
Expand Down

0 comments on commit 6b878e1

Please sign in to comment.