Skip to content

Commit

Permalink
fix: from version
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Apr 14, 2023
1 parent e3bff8f commit 11e700b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import {
loadChangelogConfig,
} from 'changelogen'

export async function generateChangelog (cwd: string, newVersion: string) {
export async function generateChangelog (cwd: string, from: string, newVersion: string) {
const config = await loadChangelogConfig(cwd, {
from,
newVersion,
})

Expand Down
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ async function run() {
const releaseName =
core.getInput('release_name', { required: false }) || tag

console.log('Tag:', tag, 'Release name:', releaseName)
const releases = await github.repos.listReleases({
owner,
repo,
per_page: 1,
})
const previousTag = releases.data[0].tag_name

console.log(`${previousTag} => ${tag}`)

let body = await generateChangelog(process.cwd(), tag.replace(/^v/, ''))
let body = await generateChangelog(process.cwd(), previousTag, tag.replace(/^v/, ''))

let lines = body.split('\n')
// Cleanup output
Expand Down

0 comments on commit 11e700b

Please sign in to comment.