diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 77ecff4..d1297d1 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -6,9 +6,14 @@ jobs: test: name: Run tests runs-on: ubuntu-latest + continue-on-error: ${{ matrix.experimental }} strategy: matrix: - codespell_pip_version: ['codespell', 'git+https://github.com/codespell-project/codespell.git'] + codespell_pip_version: ['codespell'] + experimental: [false] + include: + - codespell_pip_version: 'git+https://github.com/codespell-project/codespell.git' + experimental: true steps: - name: Checkout @@ -41,3 +46,19 @@ jobs: with: path: test/testdata only_warn: 1 + + diagnose_bats: + name: Diagnose bats + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v2 + - run: pip3 --quiet --quiet install git+https://github.com/codespell-project/codespell.git + - run: | + export INPUT_CHECK_FILENAMES="" + export INPUT_CHECK_HIDDEN="" + export INPUT_EXCLUDE_FILE="" + export INPUT_PATH="./test/testdata" + export INPUT_ONLY_WARN="" + ./entrypoint.sh diff --git a/action.yml b/action.yml index c894453..e65adf0 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,10 @@ inputs: description: 'FILE with lines that should not be changed' requred: false default: '' + skip: + description: 'Comma-separated list of files to skip (it accepts globs as well)' + requred: false + default: '' path: description: 'Path to run codespell in' requred: false diff --git a/entrypoint.sh b/entrypoint.sh index 203cace..53182e3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -24,6 +24,10 @@ echo "Exclude file '${INPUT_EXCLUDE_FILE}'" if [ "x${INPUT_EXCLUDE_FILE}" != "x" ]; then command_args="${command_args} --exclude-file ${INPUT_EXCLUDE_FILE}" fi +echo "Skipping '${INPUT_SKIP}'" +if [ "x${INPUT_SKIP}" != "x" ]; then + command_args="${command_args} --skip ${INPUT_SKIP}" +fi echo "Resulting CLI options ${command_args}" exec 5>&1 res=`{ { codespell ${command_args} ${INPUT_PATH}; echo $? 1>&4; } 1>&5; } 4>&1` diff --git a/test/test.bats b/test/test.bats index ea6b853..a842cde 100644 --- a/test/test.bats +++ b/test/test.bats @@ -8,6 +8,8 @@ FILENAME_MISSPELLING_COUNT=1 HIDDEN_MISSPELLING_COUNT=1 EXCLUDED_MISSPELLING_COUNT=1 SUBFOLDER_MISSPELLING_COUNT=1 +# From all files called example.txt +EXAMPLE_MISSPELLING_COUNT=5 export RUNNER_TEMP="/foo/runner_temp" @@ -17,6 +19,7 @@ function setup() { export INPUT_CHECK_FILENAMES="" export INPUT_CHECK_HIDDEN="" export INPUT_EXCLUDE_FILE="" + export INPUT_SKIP="" export INPUT_PATH="./test/testdata" export INPUT_ONLY_WARN="" } @@ -69,6 +72,13 @@ function setup() { [ $status -eq $expectedExitStatus ] } +@test "Check the skip option" { + expectedExitStatus=$((ROOT_MISSPELLING_COUNT + HIDDEN_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - EXAMPLE_MISSPELLING_COUNT)) + INPUT_SKIP="example.txt" + run "./entrypoint.sh" + [ $status -eq $expectedExitStatus ] +} + @test "Custom path" { expectedExitStatus=$((SUBFOLDER_MISSPELLING_COUNT)) INPUT_PATH="./test/testdata/subfolder"