Skip to content

Commit d13ccde

Browse files
authored
Ignore sections that aren't part of the labels (#118)
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.
1 parent fe0eada commit d13ccde

File tree

5 files changed

+24
-3
lines changed

5 files changed

+24
-3
lines changed

__tests__/notes.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ describe('generateReleaseNotes', () => {
162162
* chore 5
163163
* chore 6
164164
165+
## New Contributors
166+
* foo bar
167+
165168
**Full Changelog**: https://github.com/somewhere/compare/v5.0.4...v5.0.5`,
166169
},
167170
}
@@ -194,8 +197,11 @@ const markdown = `
194197
### 🧪 Tests
195198
* update by @lucacome in https://github.com/somerepo/pull/205
196199
### 🔨 Maintenance
200+
197201
* Bump aquasecurity/trivy-action from 0.8.0 to 0.9.2 by @dependabot in https://github.com/somerepo/pull/175
198202
* Bump actions/setup-go from 3 to 4 by @dependabot in https://github.com/somerepo/pull/198
203+
## New Contributors
204+
* foo
199205
200206
**Full Changelog**: https://github.com/somerepo/compare/v5.0.4...v5.0.5`
201207

dist/index.js

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/notes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ export async function splitMarkdownSections(markdown: string, categories: Catego
180180
}
181181
} else if (currentLabel !== '' && trimmedLine.startsWith('* ')) {
182182
sections[currentLabel].push(trimmedLine)
183+
} else {
184+
currentLabel = ''
183185
}
184186
})
185187

src/release.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,15 @@ export async function createOrUpdateRelease(
105105
release_id: releaseDraft.id,
106106
}))
107107

108+
const separator = '----------------------------------'
108109
core.startGroup(`${releaseDraft === undefined ? 'Create' : 'Update'} release draft for ${nextRelease}`)
110+
core.info(separator)
109111
core.info(`latestRelease: ${releaseData.latestRelease}`)
112+
core.info(separator)
110113
core.info(`releaseNotes: ${newReleaseNotes}`)
111-
core.info(`releaseURL: ' ${response.data?.html_url}`)
114+
core.info(separator)
115+
core.info(`releaseURL: ${response.data?.html_url}`)
116+
core.info(separator)
112117
core.debug(`releaseDraft: ${JSON.stringify(releaseDraft, null, 2)}`)
113118
core.debug(`${releaseDraft === undefined ? 'create' : 'update'}Release: ${JSON.stringify(response.data, null, 2)}`)
114119
core.endGroup()

0 commit comments

Comments
 (0)