Skip to content

Commit

Permalink
Added no_commit option
Browse files Browse the repository at this point in the history
  • Loading branch information
creyD committed Jan 4, 2022
1 parent 18f406b commit d36ec0e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d36ec0e

Please sign in to comment.