mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-11 19:04:20 +00:00
Add a new boolean flag to control tag deletion
Most tags are considered immutable, so you have to explicity opt into this behaviour
This commit is contained in:
parent
a80139913a
commit
1283c2357e
3 changed files with 35 additions and 0 deletions
|
@ -174,6 +174,7 @@ The following are optional as `step.with` keys
|
||||||
| `files` | String | Newline-delimited globs of paths to assets to upload for release |
|
| `files` | String | Newline-delimited globs of paths to assets to upload for release |
|
||||||
| `name` | String | Name of the release. defaults to tag name |
|
| `name` | String | Name of the release. defaults to tag name |
|
||||||
| `tag_name` | String | Name of a tag. defaults to `github.ref` |
|
| `tag_name` | String | Name of a tag. defaults to `github.ref` |
|
||||||
|
| `move_existing_tag` | Boolean | Indicator of whether to delete and recreate a tag if there is an existing release, with at a different `target_commitish`. Some projects consider tags to be immutable, in which case this should be kept unset/`false`. But some projects allow for some tags to be moved (e.g., `nightly`, etc.) |
|
||||||
| `fail_on_unmatched_files` | Boolean | Indicator of whether to fail if any of the `files` globs match nothing |
|
| `fail_on_unmatched_files` | Boolean | Indicator of whether to fail if any of the `files` globs match nothing |
|
||||||
| `repository` | String | Name of a target repository in `<owner>/<repo>` format. Defaults to GITHUB_REPOSITORY env variable |
|
| `repository` | String | Name of a target repository in `<owner>/<repo>` format. Defaults to GITHUB_REPOSITORY env variable |
|
||||||
| `target_commitish` | String | Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. |
|
| `target_commitish` | String | Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. |
|
||||||
|
|
|
@ -49,6 +49,7 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
|
input_move_existing_tag: undefined,
|
||||||
input_target_commitish: undefined,
|
input_target_commitish: undefined,
|
||||||
input_discussion_category_name: undefined
|
input_discussion_category_name: undefined
|
||||||
})
|
})
|
||||||
|
@ -68,6 +69,7 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
|
input_move_existing_tag: undefined,
|
||||||
input_target_commitish: undefined,
|
input_target_commitish: undefined,
|
||||||
input_discussion_category_name: undefined
|
input_discussion_category_name: undefined
|
||||||
})
|
})
|
||||||
|
@ -87,6 +89,7 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
|
input_move_existing_tag: undefined,
|
||||||
input_target_commitish: undefined,
|
input_target_commitish: undefined,
|
||||||
input_discussion_category_name: undefined
|
input_discussion_category_name: undefined
|
||||||
})
|
})
|
||||||
|
@ -117,6 +120,7 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
|
input_move_existing_tag: 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
|
input_discussion_category_name: undefined
|
||||||
|
@ -140,6 +144,7 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
|
input_move_existing_tag: 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
|
input_discussion_category_name: undefined
|
||||||
|
@ -162,6 +167,7 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
|
input_move_existing_tag: 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: "releases"
|
input_discussion_category_name: "releases"
|
||||||
|
@ -187,6 +193,7 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
|
input_move_existing_tag: 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
|
input_discussion_category_name: undefined
|
||||||
|
@ -211,6 +218,7 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
|
input_move_existing_tag: 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
|
input_discussion_category_name: undefined
|
||||||
|
@ -234,6 +242,30 @@ describe("util", () => {
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined,
|
input_name: undefined,
|
||||||
input_tag_name: undefined,
|
input_tag_name: undefined,
|
||||||
|
input_move_existing_tag: undefined,
|
||||||
|
input_fail_on_unmatched_files: false,
|
||||||
|
input_target_commitish: undefined,
|
||||||
|
input_discussion_category_name: undefined
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it("parses basic config with input_move_existing_tag", () => {
|
||||||
|
assert.deepStrictEqual(
|
||||||
|
parseConfig({
|
||||||
|
INPUT_MOVE_EXISTING_TAG: "true",
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
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_move_existing_tag: 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
|
input_discussion_category_name: undefined
|
||||||
|
|
|
@ -8,6 +8,7 @@ export interface Config {
|
||||||
// user provided
|
// user provided
|
||||||
input_name?: string;
|
input_name?: string;
|
||||||
input_tag_name?: string;
|
input_tag_name?: string;
|
||||||
|
input_move_existing_tag?: boolean;
|
||||||
input_repository?: string;
|
input_repository?: string;
|
||||||
input_body?: string;
|
input_body?: string;
|
||||||
input_body_path?: string;
|
input_body_path?: string;
|
||||||
|
@ -55,6 +56,7 @@ export const parseConfig = (env: Env): Config => {
|
||||||
github_repository: env.INPUT_REPOSITORY || env.GITHUB_REPOSITORY || "",
|
github_repository: env.INPUT_REPOSITORY || env.GITHUB_REPOSITORY || "",
|
||||||
input_name: env.INPUT_NAME,
|
input_name: env.INPUT_NAME,
|
||||||
input_tag_name: env.INPUT_TAG_NAME?.trim(),
|
input_tag_name: env.INPUT_TAG_NAME?.trim(),
|
||||||
|
input_move_existing_tag: env.INPUT_MOVE_EXISTING_TAG ? env.INPUT_MOVE_EXISTING_TAG === "true" : undefined,
|
||||||
input_body: env.INPUT_BODY,
|
input_body: env.INPUT_BODY,
|
||||||
input_body_path: env.INPUT_BODY_PATH,
|
input_body_path: env.INPUT_BODY_PATH,
|
||||||
input_files: parseInputFiles(env.INPUT_FILES || ""),
|
input_files: parseInputFiles(env.INPUT_FILES || ""),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue