Fixes #474 Regenerate release notes on release updates (#497)

This commit is contained in:
Radek Antoniuk
2025-02-20 15:11:25 +01:00
committed by GitHub
parent 62f16c02e7
commit a8c5a7f252
11 changed files with 952 additions and 3059 deletions

View File

@@ -1,7 +1,7 @@
import { GitHub } from "@actions/github/lib/utils"
import { OctokitResponse } from "@octokit/types"
import { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods"
import { Inputs } from "./Inputs"
import type { GitHub } from "@actions/github/lib/utils"
import type { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods"
import type { OctokitResponse } from "@octokit/types"
import type { Inputs } from "./Inputs"
export type CreateReleaseResponse = RestEndpointMethodTypes["repos"]["createRelease"]["response"]
export type ReleaseByTagResponse = RestEndpointMethodTypes["repos"]["getReleaseByTag"]["response"]
@@ -10,6 +10,7 @@ export type ListReleaseAssetsResponseData = RestEndpointMethodTypes["repos"]["li
export type UpdateReleaseResponse = RestEndpointMethodTypes["repos"]["updateRelease"]["response"]
export type UploadArtifactResponse = RestEndpointMethodTypes["repos"]["uploadReleaseAsset"]["response"]
export type CreateOrUpdateReleaseResponse = CreateReleaseResponse | UpdateReleaseResponse
export type GenerateReleaseNotesResponse = RestEndpointMethodTypes["repos"]["generateReleaseNotes"]["response"]
export type ReleaseData = {
id: number
@@ -34,6 +35,8 @@ export interface Releases {
getByTag(tag: string): Promise<ReleaseByTagResponse>
generateReleaseNotes(tag: string): Promise<GenerateReleaseNotesResponse>
listArtifactsForRelease(releaseId: number): Promise<ListReleaseAssetsResponseData>
listReleases(): Promise<ListReleasesResponse>
@@ -104,6 +107,14 @@ export class GithubReleases implements Releases {
})
}
async generateReleaseNotes(tag: string): Promise<GenerateReleaseNotesResponse> {
return this.git.rest.repos.generateReleaseNotes({
owner: this.inputs.owner,
repo: this.inputs.repo,
tag_name: tag,
})
}
async getByTag(tag: string): Promise<ReleaseByTagResponse> {
return this.git.rest.repos.getReleaseByTag({
owner: this.inputs.owner,