mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-12 03:14:19 +00:00
support linking to discussions
This commit is contained in:
parent
dd98a235fd
commit
3b6cfa9277
4 changed files with 52 additions and 17 deletions
|
@ -5,7 +5,7 @@ import {
|
||||||
parseConfig,
|
parseConfig,
|
||||||
parseInputFiles,
|
parseInputFiles,
|
||||||
unmatchedPatterns,
|
unmatchedPatterns,
|
||||||
uploadUrl
|
uploadUrl,
|
||||||
} from "../src/util";
|
} from "../src/util";
|
||||||
import * as assert from "assert";
|
import * as assert from "assert";
|
||||||
|
|
||||||
|
@ -49,7 +49,8 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
input_target_commitish: undefined
|
input_target_commitish: undefined,
|
||||||
|
input_discussion_category_name: undefined,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -67,7 +68,8 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
input_target_commitish: undefined
|
input_target_commitish: undefined,
|
||||||
|
input_discussion_category_name: undefined,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -85,7 +87,8 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
input_target_commitish: undefined
|
input_target_commitish: undefined,
|
||||||
|
input_discussion_category_name: undefined,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -104,14 +107,15 @@ describe("util", () => {
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
input_fail_on_unmatched_files: false,
|
input_fail_on_unmatched_files: false,
|
||||||
input_target_commitish: undefined
|
input_target_commitish: undefined,
|
||||||
|
input_discussion_category_name: undefined,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("parses basic config with commitish", () => {
|
it("parses basic config with commitish", () => {
|
||||||
assert.deepStrictEqual(
|
assert.deepStrictEqual(
|
||||||
parseConfig({
|
parseConfig({
|
||||||
INPUT_TARGET_COMMITISH: "affa18ef97bc9db20076945705aba8c516139abd"
|
INPUT_TARGET_COMMITISH: "affa18ef97bc9db20076945705aba8c516139abd",
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
github_ref: "",
|
github_ref: "",
|
||||||
|
@ -125,7 +129,30 @@ describe("util", () => {
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
input_fail_on_unmatched_files: false,
|
input_fail_on_unmatched_files: false,
|
||||||
input_target_commitish: "affa18ef97bc9db20076945705aba8c516139abd"
|
input_target_commitish: "affa18ef97bc9db20076945705aba8c516139abd",
|
||||||
|
input_discussion_category_name: undefined,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it("supports discussion category names", () => {
|
||||||
|
assert.deepStrictEqual(
|
||||||
|
parseConfig({
|
||||||
|
INPUT_DISCUSSION_CATEGORY_NAME: "releases",
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
github_ref: "",
|
||||||
|
github_repository: "",
|
||||||
|
github_token: "",
|
||||||
|
input_body: undefined,
|
||||||
|
input_body_path: undefined,
|
||||||
|
input_draft: undefined,
|
||||||
|
input_prerelease: undefined,
|
||||||
|
input_files: [],
|
||||||
|
input_name: undefined,
|
||||||
|
input_tag_name: undefined,
|
||||||
|
input_fail_on_unmatched_files: false,
|
||||||
|
input_target_commitish: undefined,
|
||||||
|
input_discussion_category_name: "releases",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -135,7 +162,7 @@ describe("util", () => {
|
||||||
INPUT_DRAFT: "false",
|
INPUT_DRAFT: "false",
|
||||||
INPUT_PRERELEASE: "true",
|
INPUT_PRERELEASE: "true",
|
||||||
GITHUB_TOKEN: "env-token",
|
GITHUB_TOKEN: "env-token",
|
||||||
INPUT_TOKEN: "input-token"
|
INPUT_TOKEN: "input-token",
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
github_ref: "",
|
github_ref: "",
|
||||||
|
@ -149,7 +176,8 @@ describe("util", () => {
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
input_fail_on_unmatched_files: false,
|
input_fail_on_unmatched_files: false,
|
||||||
input_target_commitish: undefined
|
input_target_commitish: undefined,
|
||||||
|
input_discussion_category_name: undefined,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -158,7 +186,7 @@ describe("util", () => {
|
||||||
parseConfig({
|
parseConfig({
|
||||||
INPUT_DRAFT: "false",
|
INPUT_DRAFT: "false",
|
||||||
INPUT_PRERELEASE: "true",
|
INPUT_PRERELEASE: "true",
|
||||||
INPUT_TOKEN: "input-token"
|
INPUT_TOKEN: "input-token",
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
github_ref: "",
|
github_ref: "",
|
||||||
|
@ -172,7 +200,8 @@ describe("util", () => {
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
input_fail_on_unmatched_files: false,
|
input_fail_on_unmatched_files: false,
|
||||||
input_target_commitish: undefined
|
input_target_commitish: undefined,
|
||||||
|
input_discussion_category_name: undefined,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -180,7 +209,7 @@ describe("util", () => {
|
||||||
assert.deepStrictEqual(
|
assert.deepStrictEqual(
|
||||||
parseConfig({
|
parseConfig({
|
||||||
INPUT_DRAFT: "false",
|
INPUT_DRAFT: "false",
|
||||||
INPUT_PRERELEASE: "true"
|
INPUT_PRERELEASE: "true",
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
github_ref: "",
|
github_ref: "",
|
||||||
|
@ -194,7 +223,8 @@ describe("util", () => {
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
input_fail_on_unmatched_files: false,
|
input_fail_on_unmatched_files: false,
|
||||||
input_target_commitish: undefined
|
input_target_commitish: undefined,
|
||||||
|
input_discussion_category_name: undefined,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,13 +37,16 @@ inputs:
|
||||||
target_commitish:
|
target_commitish:
|
||||||
description: "Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA."
|
description: "Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA."
|
||||||
required: false
|
required: false
|
||||||
|
discussion_category_name:
|
||||||
|
description: "If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. If there is already a discussion linked to the release, this parameter is ignored."
|
||||||
|
required: false
|
||||||
env:
|
env:
|
||||||
"GITHUB_TOKEN": "As provided by Github Actions"
|
"GITHUB_TOKEN": "As provided by Github Actions"
|
||||||
outputs:
|
outputs:
|
||||||
url:
|
url:
|
||||||
description: 'URL to the Release HTML Page'
|
description: "URL to the Release HTML Page"
|
||||||
id:
|
id:
|
||||||
description: 'Release ID'
|
description: "Release ID"
|
||||||
upload_url:
|
upload_url:
|
||||||
description: "URL for uploading assets to the release"
|
description: "URL for uploading assets to the release"
|
||||||
runs:
|
runs:
|
||||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -16,6 +16,7 @@ export interface Config {
|
||||||
input_prerelease?: boolean;
|
input_prerelease?: boolean;
|
||||||
input_fail_on_unmatched_files?: boolean;
|
input_fail_on_unmatched_files?: boolean;
|
||||||
input_target_commitish?: string;
|
input_target_commitish?: string;
|
||||||
|
input_discussion_category_name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const uploadUrl = (url: string): string => {
|
export const uploadUrl = (url: string): string => {
|
||||||
|
@ -62,7 +63,8 @@ export const parseConfig = (env: Env): Config => {
|
||||||
? env.INPUT_PRERELEASE == "true"
|
? env.INPUT_PRERELEASE == "true"
|
||||||
: undefined,
|
: undefined,
|
||||||
input_fail_on_unmatched_files: env.INPUT_FAIL_ON_UNMATCHED_FILES == "true",
|
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