-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes made: - Updated PR template to describe categories and add `Release Note` section - Split changelog generation into smaller steps - Update GH release step to use a correct output [category:Infrastructure]
- Loading branch information
1 parent
b277648
commit b7d779f
Showing
5 changed files
with
59 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
|
||
const {CHANGESET_BODY = ``, PACKAGE = '', VERSION} = process.env; | ||
|
||
const header = `--- | ||
'@workday/canvas-tokens-${PACKAGE}': ${VERSION || 'patch'} | ||
---`; | ||
|
||
const changeset = CHANGESET_BODY.replace(/<br>/g, '\n'); | ||
|
||
fs.writeFileSync( | ||
path.join(path.resolve('./'), './.changeset/pre-changelog.md'), | ||
`${header}\n\n${changeset}`, | ||
'utf8' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const {CHANGESET_BODY = '', PACKAGE = ''} = process.env; | ||
|
||
const allowedTitles = [PACKAGE, 'all', 'other', 'infrastructure', 'documentation']; | ||
|
||
// Regex to find blocks that starts from package name or non-specified categories | ||
const titleRegex = new RegExp(`^# (${allowedTitles.join('|')})`, 'i'); | ||
|
||
// Canvas Kit's changelog generator creates changelog based on all commits | ||
// For a given package changelog should only contain related chages | ||
// The default section name headings to "Components", | ||
// so we're updating that default with use "Other" instead. | ||
// Changelog sections are sorted alphabetically | ||
const changelogBody = CHANGESET_BODY.replace('# Components', '# Other') | ||
.split('##') | ||
.filter(block => titleRegex.test(block)) | ||
.sort((a, b) => (a > b ? 1 : -1)) | ||
.map(b => | ||
// Removes extra line breaks and changes a section heading to a bold text | ||
b.replace(/\n+$/g, '').replace(/# [a-zA-Z0-9_ ]*\n/g, a => `**${a.replace(/# |\n/g, '')}**\n`) | ||
) | ||
.join('\n\n'); | ||
|
||
const oneLineChangelog = changelogBody.replace(/\n/g, '<br>'); | ||
|
||
console.log(oneLineChangelog); |
This file was deleted.
Oops, something went wrong.