Fixes #8 Add support for draft release updating

This commit is contained in:
Nick Cipollo
2020-01-02 22:03:30 -05:00
parent c8e9e33d90
commit 04d64ce68e
5 changed files with 131 additions and 36 deletions

View File

@@ -1,6 +1,6 @@
import { Context } from "@actions/github/lib/context";
import { GitHub } from "@actions/github";
import { AnyResponse, Response, ReposCreateReleaseResponse, ReposGetReleaseByTagResponse } from "@octokit/rest";
import { AnyResponse, Response, ReposCreateReleaseResponse, ReposGetReleaseByTagResponse, ReposListReleasesResponse } from "@octokit/rest";
export interface Releases {
create(
@@ -14,6 +14,8 @@ export interface Releases {
getByTag(tag: string): Promise<Response<ReposGetReleaseByTagResponse>>
listReleases(): Promise<Response<ReposListReleasesResponse>>
update(
id: number,
tag: string,
@@ -62,6 +64,13 @@ export class GithubReleases implements Releases {
})
}
async listReleases(): Promise<Response<ReposListReleasesResponse>> {
return this.git.repos.listReleases({
owner: this.context.repo.owner,
repo: this.context.repo.repo
})
}
async getByTag(tag: string): Promise<Response<ReposGetReleaseByTagResponse>> {
return this.git.repos.getReleaseByTag({
owner: this.context.repo.owner,