forked from mirrors/action-gh-release
support linking to discussions (#136)
* support linking to discussions * fmt * wire param
This commit is contained in:
parent
dd98a235fd
commit
2861dc8673
5 changed files with 57 additions and 14 deletions
|
@ -43,6 +43,7 @@ export interface Releaser {
|
|||
draft: boolean | undefined;
|
||||
prerelease: boolean | undefined;
|
||||
target_commitish: string | undefined;
|
||||
discussion_category_name: string | undefined;
|
||||
}): Promise<{ data: Release }>;
|
||||
|
||||
updateRelease(params: {
|
||||
|
@ -55,6 +56,7 @@ export interface Releaser {
|
|||
body: string | undefined;
|
||||
draft: boolean | undefined;
|
||||
prerelease: boolean | undefined;
|
||||
discussion_category_name: string | undefined;
|
||||
}): Promise<{ data: Release }>;
|
||||
|
||||
allReleases(params: {
|
||||
|
@ -86,6 +88,7 @@ export class GitHubReleaser implements Releaser {
|
|||
draft: boolean | undefined;
|
||||
prerelease: boolean | undefined;
|
||||
target_commitish: string | undefined;
|
||||
discussion_category_name: string | undefined;
|
||||
}): Promise<{ data: Release }> {
|
||||
return this.github.rest.repos.createRelease(params);
|
||||
}
|
||||
|
@ -100,6 +103,7 @@ export class GitHubReleaser implements Releaser {
|
|||
body: string | undefined;
|
||||
draft: boolean | undefined;
|
||||
prerelease: boolean | undefined;
|
||||
discussion_category_name: string | undefined;
|
||||
}): Promise<{ data: Release }> {
|
||||
return this.github.rest.repos.updateRelease(params);
|
||||
}
|
||||
|
@ -185,6 +189,8 @@ export const release = async (
|
|||
(isTag(config.github_ref)
|
||||
? config.github_ref.replace("refs/tags/", "")
|
||||
: "");
|
||||
|
||||
const discussion_category_name = config.input_discussion_category_name;
|
||||
try {
|
||||
// you can't get a an existing draft by tag
|
||||
// so we must find one in the list of all releases
|
||||
|
@ -246,7 +252,8 @@ export const release = async (
|
|||
name,
|
||||
body,
|
||||
draft,
|
||||
prerelease
|
||||
prerelease,
|
||||
discussion_category_name
|
||||
});
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
|
@ -273,7 +280,8 @@ export const release = async (
|
|||
body,
|
||||
draft,
|
||||
prerelease,
|
||||
target_commitish
|
||||
target_commitish,
|
||||
discussion_category_name
|
||||
});
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
|
|
|
@ -16,6 +16,7 @@ export interface Config {
|
|||
input_prerelease?: boolean;
|
||||
input_fail_on_unmatched_files?: boolean;
|
||||
input_target_commitish?: string;
|
||||
input_discussion_category_name?: string;
|
||||
}
|
||||
|
||||
export const uploadUrl = (url: string): string => {
|
||||
|
@ -62,7 +63,8 @@ export const parseConfig = (env: Env): Config => {
|
|||
? env.INPUT_PRERELEASE == "true"
|
||||
: undefined,
|
||||
input_fail_on_unmatched_files: env.INPUT_FAIL_ON_UNMATCHED_FILES == "true",
|
||||
input_target_commitish: env.INPUT_TARGET_COMMITISH
|
||||
input_target_commitish: env.INPUT_TARGET_COMMITISH,
|
||||
input_discussion_category_name: env.INPUT_DISCUSSION_CATEGORY_NAME
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue