Skip to content

Commit

Permalink
[#1] fix latest release notes no refresh bug
Browse files Browse the repository at this point in the history
  • Loading branch information
feelform committed Nov 3, 2021
1 parent 5b2ec14 commit 4646492
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class GithubRelease {
commitLog() {
return `${this.name} tag: ${this.tagName} ${this.htmlURL}`
}

getTagName() {
return this.tagName
}
}

module.exports = GithubRelease
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ class ReleaseNotes {
return `v${this.version}`
}

static async makeLatestReleaseNotes(releaseClass) {
const data = await releaseClass.latest()

const tagName = ReleaseNotes.tagName(data.tag_name)
static makeLatestReleaseNotes(release) {
const tagName = ReleaseNotes.tagName(release.getTagName())
const latestReleaseNotes = whatsNewTempate.replace('__VERSION__', tagName)
.replace('__BODY__', data.body)
.replace('__BODY__', release.getBody())
return new ReleaseNotes(latestReleaseNotes, tagName)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const github = require('@actions/github')
const fs = require("fs-extra")
const axios = require('axios')
const MarkdownContents = require('./markdown-contents')
const ReleaseNotes = require('./release-notes')

class TemplateEngine {
constructor(template) {
Expand Down Expand Up @@ -40,7 +41,7 @@ const githubs = {
valueOfFilename: async function (filename, release) {
switch (filename) {
case 'latestReleaseNotes.md':
return release.getBody()
return ReleaseNotes.makeLatestReleaseNotes(release).contents
default:
return (await MarkdownContents.makeMarkdownContentsFromPinpointReadme(filename)).contents
}
Expand Down

0 comments on commit 4646492

Please sign in to comment.