From 3716fd9e3d27b1cc85b6de529d374061e575ae97 Mon Sep 17 00:00:00 2001 From: Loymdayddaud <145969603+TheGiraffe3@users.noreply.github.com> Date: Tue, 13 Oct 2026 12:52:04 +0300 Subject: [PATCH 1/8] Update README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 9e9de46..ae312eb 100644 --- a/README.md +++ b/README.md @@ -148,3 +148,15 @@ uses: codespell-project/actions-codespell@v2 with: only_warn: 1 ``` + +### Parameter: auto_fix + +Automatically fix errors. Note that this will not commit or push the changes: you will need to handle that in the workflow. + +This parameter is optional; by default `codespell` will run in "dry-run" mode. + +```yml +uses: codespell-project/actions-codespell@v2 +with: + auto_fix: 1 +``` From a81ad53a5b2b77a8d52381b01ed529331a8dd059 Mon Sep 17 00:00:00 2001 From: Loymdayddaud <145969603+TheGiraffe3@users.noreply.github.com> Date: Tue, 13 Oct 2026 12:53:25 +0300 Subject: [PATCH 2/8] Update action.yml --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index 8d6b7b5..1e4d9cb 100644 --- a/action.yml +++ b/action.yml @@ -46,6 +46,10 @@ inputs: description: 'If set, only warn, never error' required: false default: '' + auto_fix: + description: 'Write fixes automatically' + required: false + default: '' runs: using: 'docker' image: 'Dockerfile' From 831c11d6d7007d4100803e4957eb9d6da358b3e9 Mon Sep 17 00:00:00 2001 From: Loymdayddaud <145969603+TheGiraffe3@users.noreply.github.com> Date: Tue, 13 Oct 2026 12:56:05 +0300 Subject: [PATCH 3/8] Update entrypoint.sh --- entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 10b5a43..49ff418 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -24,6 +24,11 @@ if [ -n "${INPUT_CHECK_HIDDEN}" ]; then echo "Checking hidden" command_args="${command_args} --check-hidden" fi +echo "Write changes? '${INPUT_WRITE_CHANGES}'" +if [ -n "${INPUT_WRITE_CHANGES}" ]; then + echo "Writing changes" + command_args="${command_args} --write-changes" +fi echo "Config '${INPUT_CONFIG}'" if [ "x${INPUT_CONFIG}" != "x" ]; then command_args="${command_args} --config ${INPUT_CONFIG}" From a00da0623da2438fd4b39fa8fdc0eccb9c5cbbbe Mon Sep 17 00:00:00 2001 From: Loymdayddaud <145969603+TheGiraffe3@users.noreply.github.com> Date: Tue, 13 Oct 2026 12:56:29 +0300 Subject: [PATCH 4/8] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 1e4d9cb..43ae2c5 100644 --- a/action.yml +++ b/action.yml @@ -46,7 +46,7 @@ inputs: description: 'If set, only warn, never error' required: false default: '' - auto_fix: + write_changes: description: 'Write fixes automatically' required: false default: '' From 745be18941841601de537166b1a78080db50ba3e Mon Sep 17 00:00:00 2001 From: Loymdayddaud <145969603+TheGiraffe3@users.noreply.github.com> Date: Tue, 13 Oct 2026 12:57:11 +0300 Subject: [PATCH 5/8] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ae312eb..8b7f61f 100644 --- a/README.md +++ b/README.md @@ -149,14 +149,14 @@ with: only_warn: 1 ``` -### Parameter: auto_fix +### Parameter: write_changes -Automatically fix errors. Note that this will not commit or push the changes: you will need to handle that in the workflow. +Write changes. Note that this will not commit or push: you will need to handle that in the workflow. This parameter is optional; by default `codespell` will run in "dry-run" mode. ```yml uses: codespell-project/actions-codespell@v2 with: - auto_fix: 1 + write_changes: 1 ``` From f9ef415f48ab4367954126837211f46891237ed8 Mon Sep 17 00:00:00 2001 From: Loymdayddaud <145969603+TheGiraffe3@users.noreply.github.com> Date: Tue, 13 Oct 2026 20:31:04 +0300 Subject: [PATCH 6/8] add tests --- .github/workflows/testing.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f7a768a..6ae4a69 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -54,6 +54,20 @@ jobs: path: test/testdata only_warn: 1 + test_write: + name: Test that writes work + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: ./ + with: + path: test/testdata + only_warn: 1 + write_changes: true + - name: Check git status + run: | + if git diff --quiet; then echo "For some reason, no write was performed. This appears to be a bug." && exit 1; else exit 0; fi + codespell: name: Check for spelling errors runs-on: ubuntu-latest From 07f3a702ffaf0baaf96527f131a3c2d7ea44d42b Mon Sep 17 00:00:00 2001 From: Loymdayddaud <145969603+TheGiraffe3@users.noreply.github.com> Date: Tue, 13 Oct 2026 20:32:57 +0300 Subject: [PATCH 7/8] semicolonize --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b7f61f..ff824b7 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ with: ### Parameter: write_changes -Write changes. Note that this will not commit or push: you will need to handle that in the workflow. +Write changes. Note that this will not commit or push; you will need to handle that in the workflow. This parameter is optional; by default `codespell` will run in "dry-run" mode. From ef4ebc63cb768634ea00c765cf86d63bb24e0e36 Mon Sep 17 00:00:00 2001 From: Loymdayddaud <145969603+TheGiraffe3@users.noreply.github.com> Date: Wed, 14 Oct 2026 10:10:39 +0300 Subject: [PATCH 8/8] Run twice --- entrypoint.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 49ff418..5b477bc 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -27,7 +27,6 @@ fi echo "Write changes? '${INPUT_WRITE_CHANGES}'" if [ -n "${INPUT_WRITE_CHANGES}" ]; then echo "Writing changes" - command_args="${command_args} --write-changes" fi echo "Config '${INPUT_CONFIG}'" if [ "x${INPUT_CONFIG}" != "x" ]; then @@ -59,7 +58,13 @@ res=`{ { codespell --count ${command_args} ${INPUT_PATH}; echo $? 1>&4; } 1>&5; if [ "$res" = "0" ]; then echo "Codespell found no problems" else - echo "Codespell found one or more problems" + if [ -n "${INPUT_WRITE_CHANGES}" ]; then + echo "Codespell found one or more problems to be fixed" + command_args="${command_args} --write-changes" + codespell --count ${command_args} ${INPUT_PATH} &> /dev/null + else + echo "Codespell found one or more problems" + fi fi # Remove the matchers, so no other jobs hit them.