Skip to content

Commit fd59766

Browse files
authored
chore: [REL-4161] get changelog working with escaped string (#530)
This update will fix the gross changelog formatting as long as the GHA changelog input is a single-line string with `\n` characters for new lines. Tested this out and it works. <!-- ld-jira-link --> --- Related Jira issue: [REL-4161: Migrate ld-find-code-refs from Releaser to GHA](https://launchdarkly.atlassian.net/browse/REL-4161) <!-- end-ld-jira-link -->
1 parent 62e99ed commit fd59766

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
required: true
1313
type: string
1414
changeLog:
15-
description: Pending changelog
15+
description: Pending changelog (for now please escape new lines; will fix)
1616
required: true
1717
type: string
1818

scripts/release/commit-and-tag.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ tag_exists() (
1111

1212
update_changelog() (
1313
local ts=$(date +"%Y-%m-%d")
14-
local changelog_entry=$(printf "## [%s] - %s\n%s\n" "$LD_RELEASE_VERSION" "$ts" "$CHANGELOG_ENTRY")
14+
# multiline strings don't seem to be supported for GHA inputs, so for now we
15+
# require that the changelog include \n characters for new lines and then we
16+
# just expand them here
17+
# TODO improve this
18+
local changelog_content=$(printf "%b" "$CHANGELOG_ENTRY")
19+
local changelog_entry=$(printf "## [%s] - %s\n%s\n" "$LD_RELEASE_VERSION" "$ts" "$changelog_content")
1520

1621
# insert the new changelog entry (followed by empty line) after line 4
1722
# of CHANGELOG.md

0 commit comments

Comments
 (0)