Skip to content

Commit

Permalink
fix: add make_latest input to action.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed Jul 21, 2023
1 parent 4c9f44a commit edc4303
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ The following are optional as `step.with` keys
| `discussion_category_name` | String | 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. For more information, see ["Managing categories for discussions in your repository."](https://docs.github.com/en/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository) |
| `generate_release_notes` | Boolean | Whether to automatically generate the name and body for this release. If name is specified, the specified name will be used; otherwise, a name will be automatically generated. If body is specified, the body will be pre-pended to the automatically generated notes. See the [GitHub docs for this feature](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes) for more information |
| `append_body` | Boolean | Append to existing body instead of overwriting it |
| `make_latest` | Boolean | Whether to mark the release as latest or not. |
| `make_latest` | String | Specifies whether this release should be set as the latest release for the repository. If draft or prerelease is true, this parameter is ignored. Defaults to undefined which, currently, GitHub interprets as true. |

💡 When providing a `body` and `body_path` at the same time, `body_path` will be
attempted first, then falling back on `body` if the path can not be read from.
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ inputs:
append_body:
description: "Append to existing body instead of overwriting it. Default is false."
required: false
make_latest:
description: "Specifies whether this release should be set as the latest release for the repository. If draft or prerelease is true, this parameter is ignored. Defaults to undefined which, currently, GitHub interprets as true."
required: false
env:
"GITHUB_TOKEN": "As provided by Github Actions"
outputs:
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export interface Release {
draft: boolean;
prerelease: boolean;
assets: Array<{ id: number; name: string }>;
make_latest?: string | undefined;
}

export interface Releaser {
Expand Down Expand Up @@ -203,6 +202,7 @@ export const release = async (

const discussion_category_name = config.input_discussion_category_name;
const generate_release_notes = config.input_generate_release_notes;
const make_latest = config.input_make_latest;
try {
let existingRelease: Release | undefined;
for await (const response of releaser.allReleases({
Expand Down Expand Up @@ -254,10 +254,6 @@ export const release = async (
config.input_prerelease !== undefined
? config.input_prerelease
: existingRelease.prerelease;
const make_latest =
config.input_make_latest !== undefined
? config.input_make_latest
: existingRelease.make_latest;

const release = await releaser.updateRelease({
owner,
Expand All @@ -281,7 +277,6 @@ export const release = async (
const draft = config.input_draft;
const prerelease = config.input_prerelease;
const target_commitish = config.input_target_commitish;
const make_latest = config.input_make_latest;
let commitMessage: string = "";
if (target_commitish) {
commitMessage = ` using commit "${target_commitish}"`;
Expand Down
6 changes: 2 additions & 4 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface Config {
input_discussion_category_name?: string;
input_generate_release_notes?: boolean;
input_append_body?: boolean;
input_make_latest: string | undefined;
input_make_latest?: string;
}

export const uploadUrl = (url: string): string => {
Expand Down Expand Up @@ -71,9 +71,7 @@ export const parseConfig = (env: Env): Config => {
env.INPUT_DISCUSSION_CATEGORY_NAME || undefined,
input_generate_release_notes: env.INPUT_GENERATE_RELEASE_NOTES == "true",
input_append_body: env.INPUT_APPEND_BODY == "true",
input_make_latest: env.INPUT_MAKE_LATEST
? env.INPUT_MAKE_LATEST
: undefined,
input_make_latest: env.INPUT_MAKE_LATEST || undefined,
};
};

Expand Down

0 comments on commit edc4303

Please sign in to comment.