Skip to content

Commit 6eaab6f

Browse files
authored
refactor: replace --in-place with --fix (#14)
1 parent 430c560 commit 6eaab6f

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ The Sourcery CLI version to use.
132132

133133
This defaults to the latest version available.
134134

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

137137
```yaml
138138
- uses: sourcery-ai/action@v1
139139
with:
140140
token: ${{ secrets.SOURCERY_TOKEN }}
141-
version: 0.12.12
141+
version: 1.5.0
142142
```
143143

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

171-
### `in_place`
171+
### `fix`
172172

173173
> **Type**: either `true` or `false`
174174
>
175175
> **Default**: `false`
176176
>
177-
> **CLI equivalent**: `--in-place`
177+
> **CLI equivalent**: `--fix`
178178

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

action.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ inputs:
2222
default: "."
2323
version:
2424
description: >
25-
Sourcery CLI version, e.g. '1.0.3'. If empty, default to the latest version
25+
Sourcery CLI version, e.g. '1.5.0'. If empty, default to the latest version
2626
available.
2727
required: false
2828
default: ""
@@ -35,10 +35,17 @@ inputs:
3535
description: "Fail job if issues are found. Either 'true' or 'false'."
3636
required: false
3737
default: "true"
38+
fix:
39+
description: "Automatically fix issues where possible. Either 'true' or 'false'."
40+
required: false
41+
default: "false"
3842
in_place:
3943
description: "Change files in place. Either 'true' or 'false'."
4044
required: false
4145
default: "false"
46+
deprecationMessage: >
47+
This input is deprecated and will be removed in a future release. Please update
48+
your Sourcery `version` and use `fix` instead of `in_place`.
4249
config:
4350
description: "Location of the Sourcery YAML configuration file."
4451
required: false
@@ -82,6 +89,18 @@ runs:
8289
exit 1
8390
fi
8491
92+
if [ ${{ inputs.fix }} == "true" ]; then
93+
SOURCERY_OPTIONS+=( "--fix" )
94+
elif [ ${{ inputs.fix }} != "false" ]; then
95+
echo "Invalid value for input 'fix'"
96+
echo "Expected either 'true' or 'false'"
97+
echo "Got '${{ inputs.fix }}'"
98+
exit 1
99+
fi
100+
101+
# this input is deprecated and will be removed in a future release
102+
# we are keeping it here because users might have pinned Sourcery to an older
103+
# version that does not support `--fix`
85104
if [ ${{ inputs.in_place }} == "true" ]; then
86105
SOURCERY_OPTIONS+=( "--in-place" )
87106
elif [ ${{ inputs.in_place }} != "false" ]; then

0 commit comments

Comments
 (0)