Skip to content

Commit

Permalink
Refactor: get boolean input (#50)
Browse files Browse the repository at this point in the history
* 🔵 other: use getBooleanInput

**BREAKING CHANGES**: all boolean input is taking boolean volue instead of string

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
maxisam and bot authored Oct 10, 2023
1 parent abb1b9b commit 691281c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
interval: weekly

- package-ecosystem: npm
directory: /
schedule:
interval: daily
interval: weekly
8 changes: 4 additions & 4 deletions .github/workflows/test-dotnet-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
workspace: ${{ github.workspace }}/__tests__/dotnet/Console
logLevel: "detailed"
projectFileName: "Console.sln"
jscpdCheck: "true"
jscpdCheckAsError: "true"
jscpdCheck: true
jscpdCheckAsError: true

- name: log-output
run: echo "${{ steps.dotnet-format.outputs.output }}"
Expand All @@ -42,8 +42,8 @@ jobs:
authToken: ${{ secrets.GITHUB_TOKEN }}
workspace: ${{ github.workspace }}/__tests__/dotnet/ConfigConsoleApp
projectFileName: "ConfigConsoleApp.sln"
jscpdCheck: "true"
jscpdCheckAsError: "true"
jscpdCheck: true
jscpdCheckAsError: true

- name: log-output
run: echo "${{ steps.dotnet-format.outputs.output }}"
14 changes: 7 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ inputs:
onlyChangedFiles:
description: "Only changed files in the current pull request should be formatted. Only works when the trigger is a pull request."
required: false
default: "false"
default: false

failFast:
description: "The job should fail if there's a formatting error."
required: false
default: "true"
default: true

workspace:
description: "The solution or project file to operate on."
Expand All @@ -53,12 +53,12 @@ inputs:
problemMatcherEnabled:
description: "Enable the problem matcher for dotnet format."
required: false
default: "true"
default: true

skipCommit:
description: "Skip commiting the changes to the repository."
required: false
default: "false"
default: false

commitUserName:
description: Name used for the commit user
Expand All @@ -83,7 +83,7 @@ inputs:
jscpdCheck:
description: "Run jscpd to check for code duplication"
required: false
default: "false"
default: false

jscpdConfigPath:
description: "Path to jscpd config file"
Expand All @@ -93,12 +93,12 @@ inputs:
jscpdCheckAsError:
description: "Fail the build if jscpd finds any code duplication"
required: false
default: "false"
default: false

postNewComment:
description: "Post a new comment on the pull request or update an existing one with the results"
required: false
default: "false"
default: false

outputs:
hasChanges:
Expand Down
14 changes: 7 additions & 7 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ export function getInputs(): IInputs {
const inputs: IInputs = {
authToken: core.getInput(INPUTS.authToken),
action: core.getInput(INPUTS.action),
onlyChangedFiles: core.getInput(INPUTS.onlyChangedFiles) === 'true',
failFast: core.getInput(INPUTS.failFast) === 'true',
onlyChangedFiles: core.getBooleanInput(INPUTS.onlyChangedFiles),
failFast: core.getBooleanInput(INPUTS.failFast),
workspace: core.getInput(INPUTS.workspace),
projectFileName: core.getInput(INPUTS.projectFileName),
severityLevel: core.getInput(INPUTS.severityLevel) as FixLevelType,
logLevel: core.getInput(INPUTS.logLevel) as VerbosityType,
problemMatcherEnabled: core.getInput(INPUTS.problemMatcherEnabled) === 'true',
skipCommit: core.getInput(INPUTS.skipCommit) === 'true',
problemMatcherEnabled: core.getBooleanInput(INPUTS.problemMatcherEnabled),
skipCommit: core.getBooleanInput(INPUTS.skipCommit),
commitUsername: core.getInput(INPUTS.commitUsername),
commitUserEmail: core.getInput(INPUTS.commitUserEmail),
commitMessage: core.getInput(INPUTS.commitMessage),
nugetConfigPath: core.getInput(INPUTS.nugetConfigPath),
dotnetFormatConfigPath: core.getInput(INPUTS.dotnetFormatConfigPath),
jscpdConfigPath: core.getInput(INPUTS.jscpdConfigPath),
jscpdCheck: core.getInput(INPUTS.jscpdCheck) === 'true',
jscpdCheckAsError: core.getInput(INPUTS.jscpdCheckAsError) === 'true',
postNewComment: core.getInput(INPUTS.postNewComment) === 'true'
jscpdCheck: core.getBooleanInput(INPUTS.jscpdCheck),
jscpdCheckAsError: core.getBooleanInput(INPUTS.jscpdCheckAsError),
postNewComment: core.getBooleanInput(INPUTS.postNewComment)
};
core.debug(`Inputs: ${inspect(inputs)}`);
return inputs;
Expand Down

0 comments on commit 691281c

Please sign in to comment.