DEV Community

Jonas Brømsø
Jonas Brømsø

Posted on • Updated on

Release 0.34.0 of Spellcheck (GitHub) Action - another maintenance release

I have just released yet another maintenance release (0.34.0) of the GitHub Action for doing spelling checking of your documentation etc.

The release was prompted by several updates.

  • The Docker base images was updated to Python 3.11.5
  • And more importantly the core component PySpelling was updated to version 2.9

The change log can be found here:

In addition I have updated the documentation, since I found out that one of the features was not working as expected. It was not something I could fix via code, since it is dependent on how the GitHub Action is used, so a documentation update was the way to go.

By default when a GitHub Action fails, the run is marked as failed together with the failing step.

If you however have a step where you collect log information or similar in order to publish an artifact or similar, this step will not be run, when the previous step fails.

If you set the step to continue-on-error, the step will be marked as failed but the overall status of the run will not reflect this.

Pass with annotation indicating error

Pass with the actual error

Example configuration:

name: Spellcheck Action
on: push

jobs:
  build:
    name: Spellcheck
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Run Spellcheck
      id: spellcheck
      uses: rojopolis/spellcheck-github-actions@0.34.0
      continue-on-error: true
      with:
        output_file: spellcheck-output.txt
    - uses: actions/upload-artifact@v3
      with:
        name: Spellcheck Output
        path: spellcheck-output.txt

Enter fullscreen mode Exit fullscreen mode

REF: https://raw.githubusercontent.com/jonasbn/til/308a4f45d4ae7f242191aa3f3f0ddd5e4c827fe0/.github/workflows/spellcheck.yml

However, what you can do is to set the artifact generating step to only stop on cancel.

For this action, this could look as follows:

name: Spellcheck Action
on: push

jobs:
  build:
    name: Spellcheck
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Run Spellcheck
      id: spellcheck
      uses: rojopolis/spellcheck-github-actions@0.34.0
      with:
        output_file: spellcheck-output.txt
    - uses: actions/upload-artifact@v3
      if: '!cancelled()'
      with:
        name: Spellcheck Output
        path: spellcheck-output.txt
Enter fullscreen mode Exit fullscreen mode

REF: https://raw.githubusercontent.com/jonasbn/til/master/.github/workflows/spellcheck.yml

When the spelling check step fails, we want to collect the log, so we can correct the spelling mistakes collected in the log.

You can of course, inspect it via GitHub, but this might not be optimal if you have a log of files and/or spelling mistakes.

With the line: if: '!cancelled()' we still respect if the run is cancelled, but we generate the artifact both upon success and error.

Fail and annotation

Fail and actual error

It has taken me quite some time and a lot of runs to get this to work, luckily I was not the only one with the problem, so a solution was available.

Top comments (0)