Skip to content

Commit

Permalink
Merge pull request #14 from donaldwasserman/master
Browse files Browse the repository at this point in the history
Fix New Line Issues
  • Loading branch information
donaldwasserman authored Jan 27, 2020
2 parents 018b668 + 54da426 commit d5f2663
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }} # Required
changelog: 'CHANGELOG.md' # optional, default: CHANGELOG.md
use_pullrequest: true
8 changes: 3 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,7 @@ async function run() {
usePr = core.getInput('use_pullrequest'),
defaultBranch = core.getInput('default_branch'),
ownerRepo = process.env.GITHUB_REPOSITORY,
eventPath = process.env.GITHUB_EVENT_PATH,
eventName = process.env.GITHUB_EVENT_NAME;
eventPath = process.env.GITHUB_EVENT_PATH;

const [owner, repo] = ownerRepo.split('/');

Expand All @@ -532,7 +531,7 @@ async function run() {
sha = data.sha;
}
let contentBuffer = Buffer.from(data.content, 'base64');
currentContents = `${contentBuffer.toString('utf8')} ${NEWLINE}`;
currentContents = `${contentBuffer.toString('utf8')}`;
} catch (e) {
changelogExists = false;
}
Expand All @@ -541,8 +540,7 @@ async function run() {

let branch = defaultBranch || releaseBranch;

let newContents =
`### [${name}](${url}) ${NEWLINE} **${tag}** ${NEWLINE} ${body}` + currentContents;
let newContents = `### [${name}](${url}) ${NEWLINE} **${tag}** ${NEWLINE} ${body} ${NEWLINE} ${currentContents}`;
let buff = new Buffer.from(newContents);
let content = buff.toString('base64');

Expand Down
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ async function run() {
usePr = core.getInput('use_pullrequest'),
defaultBranch = core.getInput('default_branch'),
ownerRepo = process.env.GITHUB_REPOSITORY,
eventPath = process.env.GITHUB_EVENT_PATH,
eventName = process.env.GITHUB_EVENT_NAME;
eventPath = process.env.GITHUB_EVENT_PATH;

const [owner, repo] = ownerRepo.split('/');

Expand All @@ -38,7 +37,7 @@ async function run() {
sha = data.sha;
}
let contentBuffer = Buffer.from(data.content, 'base64');
currentContents = `${contentBuffer.toString('utf8')} ${NEWLINE}`;
currentContents = `${contentBuffer.toString('utf8')}`;
} catch (e) {
changelogExists = false;
}
Expand All @@ -47,8 +46,7 @@ async function run() {

let branch = defaultBranch || releaseBranch;

let newContents =
`### [${name}](${url}) ${NEWLINE} **${tag}** ${NEWLINE} ${body}` + currentContents;
let newContents = `### [${name}](${url}) ${NEWLINE} **${tag}** ${NEWLINE} ${body} ${NEWLINE} ${currentContents}`;
let buff = new Buffer.from(newContents);
let content = buff.toString('base64');

Expand Down

0 comments on commit d5f2663

Please sign in to comment.