diff --git a/README.md b/README.md index 17992b3..9caef92 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ The following parameters can be used in your custom action configuration. | commit_options | :x: | - | Custom git commit options | | file_pattern | :x: | '*' | Custom file pattern for `git add` | | checkpath | :x: | '.' | The path autopep8 checks | +| no_commit | :x: | False | Avoid committing, if used in a pipeline | | options | :x: | ' ' | Parameters to use with autopep8 | | dry | :x: | false | Dry-run the action to fail when detecting PEP-8 uncompliant files, instead of automatically fixing them. | diff --git a/action.yml b/action.yml index 691e128..9fc01e1 100644 --- a/action.yml +++ b/action.yml @@ -27,6 +27,10 @@ inputs: description: Should this script apply autopep8 directly or just warn? required: false default: false + no_commit: + description: Can be used to avoid committing the changes + required: false + default: false runs: using: 'docker' diff --git a/entrypoint.sh b/entrypoint.sh index 8946152..c710a29 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,6 +28,10 @@ _git_changed() { echo "Running autopep8..." autopep8 -i -r $INPUT_CHECKPATH $INPUT_OPTIONS || echo "Problem running autopep8!" +if $INPUT_NO_COMMIT; then + exit 0 +fi + if _git_changed; then if $INPUT_DRY; then