mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 00:51:11 -05:00
Merge pull request #657 from bnjbvr/write-changes
Allow writing changes in the github action
This commit is contained in:
commit
efa38136f2
3 changed files with 21 additions and 0 deletions
|
@ -20,6 +20,11 @@ inputs:
|
|||
required: false
|
||||
default: false
|
||||
|
||||
write_changes:
|
||||
description: "Write changes to the repository"
|
||||
required: false
|
||||
default: false
|
||||
|
||||
config:
|
||||
description: "Use a custom config file."
|
||||
required: false
|
||||
|
|
|
@ -43,6 +43,11 @@ if [ "${INPUT_ISOLATED:-false}" == "true" ]; then
|
|||
ARGS+=" --isolated"
|
||||
fi
|
||||
|
||||
# Write changes to the repository
|
||||
if [ "${INPUT_WRITE_CHANGES:-false}" == "true" ]; then
|
||||
ARGS+=" --write-changes"
|
||||
fi
|
||||
|
||||
# Use a custom configuration file
|
||||
if [[ -n "${INPUT_CONFIG:-}" ]]; then
|
||||
ARGS+=" --config ${INPUT_CONFIG}"
|
||||
|
|
|
@ -32,13 +32,23 @@ jobs:
|
|||
with:
|
||||
files: ./file.txt
|
||||
isolated: true
|
||||
|
||||
- name: Writes changes in the local checkout
|
||||
uses: crate-ci/typos@master
|
||||
with:
|
||||
write_changes: true
|
||||
```
|
||||
|
||||
**Important** for any of the examples above, make sure that you choose
|
||||
a release or commit as a version, and not a branch (which is a moving target).
|
||||
|
||||
Also make sure when referencing relative file paths to use `./` (e.g., `./file.txt` instead of
|
||||
`file.txt`.
|
||||
|
||||
`write_changes` doesn't commit or push anything to the branch. It only writes the changes locally
|
||||
to disk, and this can be combined with other actions, for instance that will [submit code
|
||||
suggestions based on that local diff](https://github.com/getsentry/action-git-diff-suggestions).
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Description | Required | Default |
|
||||
|
@ -46,3 +56,4 @@ Also make sure when referencing relative file paths to use `./` (e.g., `./file.t
|
|||
| files| Files or patterns to check | false | If not defined, entire repository is checked |
|
||||
| isolated | Ignore implicit configuration files | false | false|
|
||||
| config | Use a custom config file (must exist) | false | not set |
|
||||
| write_changes | Writes changes on the Action's local checkout | false | false |
|
||||
|
|
Loading…
Reference in a new issue