Skip to content

Commit

Permalink
Validate input and fix input name
Browse files Browse the repository at this point in the history
  • Loading branch information
yassine-cc committed Sep 18, 2024
1 parent 5c14dcd commit 6e2e519
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ inputs:
description: >-
The version of testdriverai to run. Defaults to "latest"
required: false
createPR:
create-pr:
type: boolean
description: >-
Specify if a PR should be created with the updated test results. Defaults to "false"
Expand Down
11 changes: 7 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33634,17 +33634,20 @@ const github = __nccwpck_require__(5438);

class Config {
constructor() {
const createPR = core.getInput("create-pr")?.toLowerCase()?.trim();
if (!["true", "false"].includes(createPR)) {
throw new Error(
"Invalid value for create-pr input. It should be either true or false."
);
}
this.input = {
prompt: core.getInput("prompt"),
prerun: core.getInput("prerun"),
branch: core.getInput("branch") || "main",
key: core.getInput("key"),
os: core.getInput("os") || "windows",
version: core.getInput("version") || "latest",
createPR:
core.getInput("create-pr")?.toLowerCase()?.trim() === "true"
? true
: false,
createPR: JSON.parse(createPR),
};

// the values of github.context.repo.owner and github.context.repo.repo are taken from
Expand Down
11 changes: 7 additions & 4 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ const github = require("@actions/github");

class Config {
constructor() {
const createPR = core.getInput("create-pr")?.toLowerCase()?.trim();
if (!["true", "false"].includes(createPR)) {
throw new Error(
"Invalid value for create-pr input. It should be either true or false."
);
}
this.input = {
prompt: core.getInput("prompt"),
prerun: core.getInput("prerun"),
branch: core.getInput("branch") || "main",
key: core.getInput("key"),
os: core.getInput("os") || "windows",
version: core.getInput("version") || "latest",
createPR:
core.getInput("create-pr")?.toLowerCase()?.trim() === "true"
? true
: false,
createPR: JSON.parse(createPR),
};

// the values of github.context.repo.owner and github.context.repo.repo are taken from
Expand Down

0 comments on commit 6e2e519

Please sign in to comment.