Skip to content

Commit

Permalink
feat: PLT-239 git diff of tags in changelog (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
robgutsopedra authored Aug 1, 2022
1 parent 5c85b22 commit d4ff9c2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
3 changes: 0 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ inputs:
description: 'Update changelog'
required: false
default: true
merged_branch:
description: 'Merged branch - only necessary for adding some info to changelog'
required: false
initial_release:
description: 'In case no release is present in the repo, which one should be the base release from which to bump - defaults to 0.0.0'
required: false
Expand Down
14 changes: 1 addition & 13 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9190,19 +9190,7 @@ const start = async () => {
const fileSha = fileToUpdate.data.sha;
const fileContent = gBase64.decode(fileToUpdate.data.content);
const changelogDate = new Date();
let updatedFileContent = gBase64.encode(changelogDate.toISOString().split('T')[0] + ", " + nextReleaseTag + "\n\n" + `\t${String.fromCodePoint(0x2022)} ${commitMessage.repository.pullRequest.mergeCommit.messageHeadline} (${commitMessage.repository.pullRequest.mergeCommit.author.name})\n` + fileContent);
let diffMergedBranch;
console.log("What is merged_branch?" + core.getInput('merged_branch'));
if (core.getInput('merged_branch')) {
diffMergedBranch = await octokit.request(`GET /repos/{owner}/{repo}/compare/{base}...{head}`, {
repo: repoDetails.repoName,
owner: repoDetails.repoOwner,
base: "main",
head: core.getInput('merged_branch')
});
console.log("tagDiffs is " + diffMergedBranch.data.html_url);
updatedFileContent = gBase64.encode(changelogDate.toISOString().split('T')[0] + ", " + nextReleaseTag + "\n\n" + `\t${String.fromCodePoint(0x2022)} Commit --> ${commitMessage.repository.pullRequest.mergeCommit.messageHeadline} (${commitMessage.repository.pullRequest.mergeCommit.author.name})\n` + `\t${String.fromCodePoint(0x2022)} Diff --> ${diffMergedBranch.data.html_url}\n` + fileContent);
}
updatedFileContent = gBase64.encode(changelogDate.toISOString().split('T')[0] + ", " + nextReleaseTag + "\n\n" + `\t${String.fromCodePoint(0x2022)} Commit --> ${commitMessage.repository.pullRequest.mergeCommit.messageHeadline} (${commitMessage.repository.pullRequest.mergeCommit.author.name})\n` + `\t${String.fromCodePoint(0x2022)} Diff --> https://github.com/${repoDetails.repoOwner}/${repoDetails.repoName}/compare/${latestVersion}...${nextReleaseTag}\n` + fileContent);
const changelogResult = await octokit.request(`PUT /repos/{owner}/{repo}/contents/${repoDetails.changelogFile}`, {
repo: repoDetails.repoName,
owner: repoDetails.repoOwner,
Expand Down
15 changes: 2 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,8 @@ const start = async () => {
const fileSha = fileToUpdate.data.sha
const fileContent = Base64.decode(fileToUpdate.data.content)
const changelogDate = new Date()
let updatedFileContent = Base64.encode(changelogDate.toISOString().split('T')[0] + ", " + nextReleaseTag + "\n\n" + `\t${String.fromCodePoint(0x2022)} ${commitMessage.repository.pullRequest.mergeCommit.messageHeadline} (${commitMessage.repository.pullRequest.mergeCommit.author.name})\n` + fileContent)
let diffMergedBranch
console.log("What is merged_branch?" + core.getInput('merged_branch'))
if(core.getInput('merged_branch')){
diffMergedBranch = await octokit.request(`GET /repos/{owner}/{repo}/compare/{base}...{head}`, {
repo: repoDetails.repoName,
owner: repoDetails.repoOwner,
base: "main",
head: core.getInput('merged_branch')
})
console.log("tagDiffs is " + diffMergedBranch.data.html_url)
updatedFileContent = Base64.encode(changelogDate.toISOString().split('T')[0] + ", " + nextReleaseTag + "\n\n" + `\t${String.fromCodePoint(0x2022)} Commit --> ${commitMessage.repository.pullRequest.mergeCommit.messageHeadline} (${commitMessage.repository.pullRequest.mergeCommit.author.name})\n` + `\t${String.fromCodePoint(0x2022)} Diff --> ${diffMergedBranch.data.html_url}\n` + fileContent)
}
updatedFileContent = Base64.encode(changelogDate.toISOString().split('T')[0] + ", " + nextReleaseTag + "\n\n" + `\t${String.fromCodePoint(0x2022)} Commit --> ${commitMessage.repository.pullRequest.mergeCommit.messageHeadline} (${commitMessage.repository.pullRequest.mergeCommit.author.name})\n` + `\t${String.fromCodePoint(0x2022)} Diff --> https://github.com/${repoDetails.repoOwner}/${repoDetails.repoName}/compare/${latestVersion}...${nextReleaseTag}\n` + fileContent)

const changelogResult = await octokit.request(`PUT /repos/{owner}/{repo}/contents/${repoDetails.changelogFile}`, {
repo: repoDetails.repoName,
owner: repoDetails.repoOwner,
Expand Down

0 comments on commit d4ff9c2

Please # to comment.