Skip to content

Commit

Permalink
refactor: replace --in-place with --fix (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruancomelli authored Jul 4, 2023
1 parent 430c560 commit 6eaab6f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ The Sourcery CLI version to use.

This defaults to the latest version available.

To choose a specific version (let's say `v0.12.12`):
To choose a specific version (let's say `v1.5.0`):

```yaml
- uses: sourcery-ai/action@v1
with:
token: ${{ secrets.SOURCERY_TOKEN }}
version: 0.12.12
version: 1.5.0
```

We recommend you _not_ to this option unless strictly necessary. Pinning a Sourcery
Expand Down Expand Up @@ -168,13 +168,13 @@ Whether Sourcery should return an error code or not if issues are found in the c
This defaults to `true`, and hence the Sourcery CI step will fail in case Sourcery finds
issues in your code. You can pass `false` to prevent that behavior.

### `in_place`
### `fix`

> **Type**: either `true` or `false`
>
> **Default**: `false`
>
> **CLI equivalent**: `--in-place`
> **CLI equivalent**: `--fix`

Whether Sourcery should automatically fix and modify the reviewed files in-place or not.

Expand Down
21 changes: 20 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
default: "."
version:
description: >
Sourcery CLI version, e.g. '1.0.3'. If empty, default to the latest version
Sourcery CLI version, e.g. '1.5.0'. If empty, default to the latest version
available.
required: false
default: ""
Expand All @@ -35,10 +35,17 @@ inputs:
description: "Fail job if issues are found. Either 'true' or 'false'."
required: false
default: "true"
fix:
description: "Automatically fix issues where possible. Either 'true' or 'false'."
required: false
default: "false"
in_place:
description: "Change files in place. Either 'true' or 'false'."
required: false
default: "false"
deprecationMessage: >
This input is deprecated and will be removed in a future release. Please update
your Sourcery `version` and use `fix` instead of `in_place`.
config:
description: "Location of the Sourcery YAML configuration file."
required: false
Expand Down Expand Up @@ -82,6 +89,18 @@ runs:
exit 1
fi
if [ ${{ inputs.fix }} == "true" ]; then
SOURCERY_OPTIONS+=( "--fix" )
elif [ ${{ inputs.fix }} != "false" ]; then
echo "Invalid value for input 'fix'"
echo "Expected either 'true' or 'false'"
echo "Got '${{ inputs.fix }}'"
exit 1
fi
# this input is deprecated and will be removed in a future release
# we are keeping it here because users might have pinned Sourcery to an older
# version that does not support `--fix`
if [ ${{ inputs.in_place }} == "true" ]; then
SOURCERY_OPTIONS+=( "--in-place" )
elif [ ${{ inputs.in_place }} != "false" ]; then
Expand Down

0 comments on commit 6eaab6f

Please sign in to comment.