Skip to content

Commit

Permalink
Ignore sections that aren't part of the labels (#118)
Browse files Browse the repository at this point in the history
Fixes a bug that wouldn't recognize a new header like ## New
Contributors after it was done processing all the changes for the last
label.
  • Loading branch information
lucacome authored Jun 27, 2023
1 parent fe0eada commit d13ccde
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
6 changes: 6 additions & 0 deletions __tests__/notes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ describe('generateReleaseNotes', () => {
* chore 5
* chore 6
## New Contributors
* foo bar
**Full Changelog**: https://github.com/somewhere/compare/v5.0.4...v5.0.5`,
},
}
Expand Down Expand Up @@ -194,8 +197,11 @@ const markdown = `
### 🧪 Tests
* update by @lucacome in https://github.com/somerepo/pull/205
### 🔨 Maintenance
* Bump aquasecurity/trivy-action from 0.8.0 to 0.9.2 by @dependabot in https://github.com/somerepo/pull/175
* Bump actions/setup-go from 3 to 4 by @dependabot in https://github.com/somerepo/pull/198
## New Contributors
* foo
**Full Changelog**: https://github.com/somerepo/compare/v5.0.4...v5.0.5`

Expand Down
10 changes: 9 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ export async function splitMarkdownSections(markdown: string, categories: Catego
}
} else if (currentLabel !== '' && trimmedLine.startsWith('* ')) {
sections[currentLabel].push(trimmedLine)
} else {
currentLabel = ''
}
})

Expand Down
7 changes: 6 additions & 1 deletion src/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ export async function createOrUpdateRelease(
release_id: releaseDraft.id,
}))

const separator = '----------------------------------'
core.startGroup(`${releaseDraft === undefined ? 'Create' : 'Update'} release draft for ${nextRelease}`)
core.info(separator)
core.info(`latestRelease: ${releaseData.latestRelease}`)
core.info(separator)
core.info(`releaseNotes: ${newReleaseNotes}`)
core.info(`releaseURL: ' ${response.data?.html_url}`)
core.info(separator)
core.info(`releaseURL: ${response.data?.html_url}`)
core.info(separator)
core.debug(`releaseDraft: ${JSON.stringify(releaseDraft, null, 2)}`)
core.debug(`${releaseDraft === undefined ? 'create' : 'update'}Release: ${JSON.stringify(response.data, null, 2)}`)
core.endGroup()
Expand Down

0 comments on commit d13ccde

Please sign in to comment.