Skip to content

Commit 18930aa

Browse files
committed
Changing flag to be clearer
1 parent 3f54312 commit 18930aa

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

src/action/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function main(): Promise<void> {
2323
tag: getInput("tag"),
2424
access: getInput("access") as Access,
2525
dryRun: getInput("dry-run").toLowerCase() === "true",
26-
greaterVersion: getInput("greater-version").toLowerCase() === "true",
26+
greaterVersionOnly: getInput("greater-version-only").toLowerCase() === "true",
2727
debug: debugHandler,
2828
};
2929

src/normalize-options.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface NormalizedOptions {
1313
access?: Access;
1414
dryRun: boolean;
1515
checkVersion: boolean;
16-
greaterVersion: boolean;
16+
greaterVersionOnly: boolean;
1717
quiet: boolean;
1818
debug: Debug;
1919
}
@@ -37,10 +37,10 @@ export function normalizeOptions(options: Options): NormalizedOptions {
3737
dryRun: options.dryRun || false,
3838
checkVersion:
3939
options.checkVersion === undefined ? true : Boolean(options.checkVersion),
40-
greaterVersion:
41-
options.greaterVersion === undefined
40+
greaterVersionOnly:
41+
options.greaterVersionOnly === undefined
4242
? false
43-
: Boolean(options.greaterVersion),
43+
: Boolean(options.greaterVersionOnly),
4444
quiet: options.quiet || false,
4545
debug: options.debug || (() => undefined),
4646
};

src/npm-publish.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function npmPublish(opts: Options = {}): Promise<Results> {
2424
let shouldPublish =
2525
!options.checkVersion ||
2626
// compare returns 1 if manifest is higher than published
27-
(options.greaterVersion && cmp === 1) ||
27+
(options.greaterVersionOnly && cmp === 1) ||
2828
// compare returns 0 if the manifest is the same as published
2929
cmp !== 0;
3030

@@ -33,13 +33,11 @@ export async function npmPublish(opts: Options = {}): Promise<Results> {
3333
await npm.publish(manifest, options);
3434
}
3535

36-
// The version should be marked as lower if we disallow decrementing the version
37-
let type =
38-
(options.greaterVersion && cmp === -1 && "lower") || diff || "none";
39-
4036
let results: Results = {
4137
package: manifest.name,
42-
type,
38+
// The version should be marked as lower if we disallow decrementing the version
39+
type:
40+
(options.greaterVersionOnly && cmp === -1 && "lower") || diff || "none",
4341
version: manifest.version.raw,
4442
oldVersion: publishedVersion.raw,
4543
tag: options.tag,

src/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export interface Options {
7070
*
7171
* Defaults to `false`
7272
*/
73-
greaterVersion?: boolean;
73+
greaterVersionOnly?: boolean;
7474

7575
/**
7676
* A function to call to log debug messages.

test/specs/action/success.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ describe("GitHub Action - success tests", () => {
155155
let cli = exec.action({
156156
env: {
157157
INPUT_TOKEN: "my-secret-token",
158-
"INPUT_GREATER-VERSION": "true",
158+
"INPUT_GREATER-VERSION-ONLY": "true",
159159
},
160160
});
161161

0 commit comments

Comments
 (0)