This repository has been archived by the owner on Nov 21, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix inplace option being always overwritten
Observation ----------- I observed that the following action **always** passes - even after I added bad indentation on purpose. ``` name: lint on: push jobs: clang-format: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: clang format uses: DoozyX/[email protected] with: extensions: 'h,cpp' clangFormatVersion: 10 ``` For example, the following call always returns an exit code of 0: ``` docker run -it --rm --workdir /src -v $(pwd):/src clang-format-lint \ "--clang-format-executable" "/clang-format/clang-format10" "-r" \ "--inplace" "false" "--extensions" "h,cpp" "--exclude" "none" "." ``` The bug ------- Turns out that `--inplace` was parsed wrong and as soon as `--inplace` is passed (and it is always passed) it essentially actually meant `--inplace True`. And when `--inplace True` is passed, then the exit code will be 0 and thus the action always is successful. See https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse for more information on parsing booleans. Running the above Docker command with my fix actually returns an exit code of 1 and thus the actions also fails as expected.
- Loading branch information