Release 0.24.0 of Spellcheck (GitHub) Action - a feature release introducing optional artifacts
Tags: release, opensource, githubaction, spelling
Published: 2022-05-17 19:28:17

---
title: Release 0.24.0 of Spellcheck (GitHub) Action - a feature release introducing optional artifacts
published: true
description: Now you can get an artifact for offline inspection from your spellcheck runs
tags: release, opensource, githubaction, spelling
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m7hy9pjih7o80toihpa0.png
---
I am happy to announce a new feature release of [Spellcheck GitHub Action](https://github.com/marketplace/actions/github-spellcheck-action) - `0.24.0`.

The feature release introduces the ability to generate an artifact with all the output from the run of the action of `pyspelling` the core component of the action.

The idea was proposed by Riccardo Porreca ([@riccardoporreca](https://github.com/riccardoporreca)), who has contributed to version `0.18.0`.

I started investigating the idea, having no experience with working with GitHub action artifacts at all. I got it working, but had to push my initial changes to see it work, which meant that the master branch went _unstable_ (something we state in the documentation), I did however not succeed entirely, since I could specify and generate the artifact, but I could not extract it from the Docker image. I could retrieve the artifact when using Docker locally, but this is a GitHub action, so a little more was required.

I reached out to Riccardo with a status and luckily he is quite knowledgeable on the topic and we where able to adjust the solution.

In addition Riccardo had provided me with a quite a few pointers for improvements and I started to implement them, _breaking_ everything as I went along. I continued to test and improve the code and got it working. Only to see that Riccardo had pointed out all the errors I had made. Well we got to the same point eventually, but could have save sometime had I paid attention to my notification instead of _zoning out_ (thanks "[Drone Zone](https://somafm.com/dronezone/)").

Thanks to Riccardo for the initial idea, reviews, comments and suggestions.

The idea with the artifact, well I do not know what Riccardo want to do, but I can see a use case where you can retrieve the output and process it to fix your spelling errors using your preferred toolchain.

The artifact can of course be downloaded via the GitHub UI. You can however also access it via the API.

The following examples are using the [GitHub CLI client](https://cli.github.com/) ([documentation](https://cli.github.com/manual/gh_api)), but `curl` or similar can be used, consult the referenced documentation for details.

First you configure that you want an artifact:

```yaml
name: Spellcheck Action
on: push

jobs:
  build:
    name: Spellcheck
    runs-on: ubuntu-latest
    steps:
    # The checkout step
    - uses: actions/checkout@master
    - uses: rojopolis/spellcheck-github-actions@0.24.0
      name: Spellcheck
      with:
        source_files: README.md CHANGELOG.md notes/Notes.md
        task_name: Markdown
        output_file: spellcheck-output.txt
```

The new an interesting parameter is `output_file` this acts both as an enabler and you can also specify the name of your artifact.

```yaml
output_file: spellcheck-output.txt
```

Second, you run a test.

```bash
gh workflow run "Spellcheck Action"
```

NB! your name of the spellchech action might vary.

Then you inquire if there are any artifacts.

```bash
gh api \
  -H "Accept: application/vnd.github.v3+json" \
  /repos/rojopolis/spellcheck-github-actions/actions/artifacts
```

From the JSON response, you extract the ID of the artifact you want.

Then you download the artifact.

```bash
gh api \
  -H "Accept: application/vnd.github.v3+json" \
  /repos/rojopolis/spellcheck-github-actions/actions/artifacts/243391075,/zip > artifact.zip
```

Unpack the artifact.

```bash
unzip artifact.zip
```

Inspect the artifact (`spellcheck-output.txt` as specified in the configuration).

```bash
cat spellcheck-output.txt
Spelling check passed :)
```

The result is of course more interesting if you have several spelling mistakes or candidates for your custom dictionary - switch language if your want a lot of output or temporarily _empty_ your `.wordlist.txt`.

Artifacts are available for 3 months and can be listed, viewed and deleted via the APIs (and the UI I believe).

Feedback and questions about this new feature is of course welcome, here as well as in [the Discussions section in the GitHub repository](https://github.com/rojopolis/spellcheck-github-actions/discussions).

## Change Log

### 0.24.0, 2022-05-17, feature release, update not required

- @riccardoporreca created issue [#68](https://github.com/rojopolis/spellcheck-github-actions/issues/68) requested the ability to create an output artifact.
  
  With release 0.24.0 this is now available.

  The action configuration has to have the `output_file` parameter specified, which is a new optional parameter.

  ```yaml
  name: Spellcheck Action
  
  on:
    workflow_dispatch:
    push:
  
  jobs:
    build:
      name: Spellcheck
      runs-on: ubuntu-latest
      steps:
  
      - uses: actions/checkout@v3
  
      - uses: rojopolis/spellcheck-github-actions@0.24.0
        name: Spellcheck (no output file)
        with:
          source_files: README.md CHANGELOG.md
  
      - uses: rojopolis/spellcheck-github-actions@0.24.0
        name: Spellcheck (with output file)
        with:
          source_files: README.md CHANGELOG.md
          task_name: Markdown
          output_file: spellcheck-output.txt
  
      - uses: actions/upload-artifact@v3
        name: Archive spellcheck output output
        with:
          name: Spellcheck artifact
          path: spellcheck-output.txt
  ```

  This introduces the use of the `upload-artifact@v3` action.

  The generated artifact can be downloaded via GitHub UI/API, please consult the documentation for details and pointers.

  Thanks to @riccardoporreca for his suggestion and additional review and comments on PR by @jonasbn

  The release will be available for 365 days, with the new [sunset policy](https://github.com/rojopolis/spellcheck-github-actions/wiki#sunset-policy)