Fixes #542 Add previous tag option (#550)

This commit is contained in:
Nick Cipollo
2025-09-02 15:56:40 -04:00
committed by GitHub
parent 98d25d4189
commit e87de4c2e4
8 changed files with 99 additions and 21 deletions

View File

@@ -197,7 +197,7 @@ export class Action {
return body
}
const response = await this.releases.generateReleaseNotes(this.inputs.tag)
const response = await this.releases.generateReleaseNotes(this.inputs.tag, this.inputs.generateReleaseNotesPreviousTag)
const releaseNotes = response.data.body
if (!body || body.trim() === "") {

View File

@@ -15,6 +15,7 @@ export interface Inputs {
readonly createdReleaseName?: string
readonly discussionCategory?: string
readonly generateReleaseNotes: boolean
readonly generateReleaseNotesPreviousTag?: string
readonly immutableCreate: boolean
readonly makeLatest?: "legacy" | "true" | "false" | undefined
readonly omitBodyDuringUpdate: boolean
@@ -138,6 +139,11 @@ export class CoreInputs implements Inputs {
return generate == "true"
}
get generateReleaseNotesPreviousTag(): string | undefined {
const previousTag = core.getInput("generateReleaseNotesPreviousTag")
return previousTag || undefined
}
get immutableCreate(): boolean {
const immutable = core.getInput("immutableCreate")
return immutable == "true"

View File

@@ -36,7 +36,7 @@ export interface Releases {
getByTag(tag: string): Promise<ReleaseByTagResponse>
generateReleaseNotes(tag: string): Promise<GenerateReleaseNotesResponse>
generateReleaseNotes(tag: string, previousTag?: string): Promise<GenerateReleaseNotesResponse>
listArtifactsForRelease(releaseId: number): Promise<ListReleaseAssetsResponseData>
@@ -106,12 +106,18 @@ export class GithubReleases implements Releases {
})
}
async generateReleaseNotes(tag: string): Promise<GenerateReleaseNotesResponse> {
return this.git.rest.repos.generateReleaseNotes({
async generateReleaseNotes(tag: string, previousTag?: string): Promise<GenerateReleaseNotesResponse> {
const params: any = {
owner: this.inputs.owner,
repo: this.inputs.repo,
tag_name: tag,
})
}
if (previousTag) {
params.previous_tag_name = previousTag
}
return this.git.rest.repos.generateReleaseNotes(params)
}
async getByTag(tag: string): Promise<ReleaseByTagResponse> {