Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello! First of all, I'm sorry if I did not create an issue before submitting this pull request (PR). However, since the issue and the possible fix is very straightforward, I just submitted the PR along with my explanation.
This PR fixes
useDocker
parsing from given boolean string (e.g.true
/false
string value) to a boolean value in JavaScript/TypeScript.I noticed a problem with the parsing when trying to use this GitHub Action (
v1.0.7
) to deploy an app to Heroku using Git. My app does not useDockerfile
, but my deployment workflow that using this GitHub Action always attempted to deploy the app as Docker container even though I have setuseDocker
tofalse
in my workflow. After I looked up the source code of this GitHub Action, I think the problem was at howuseDocker
is parsed.Originally,
useDocker
was assigned by reading the string value from the input and parsed by instantiating a newBoolean
object with string value as input for theBoolean
's constructor. After that, theBoolean
object is evaluated in the conditionalif
. The result of the evaluation always returntrue
boolean value, hence the deployment always choose to Docker instead of Git.I implemented a fix by replacing
core.getInput()
withcore.getBooleanInput()
. According to@actions/core
documentation,core.getBooleanInput()
will parse the string in the input to its correct boolean value representation. I think this approach is more intuitive than the original version where the input need to be parsed into aBoolean
object constructor.