DEV Community

Cover image for Release 0.24.0 of Spellcheck (GitHub) Action - a feature release introducing optional artifacts
Jonas Brømsø
Jonas Brømsø

Posted on • Updated on

Release 0.24.0 of Spellcheck (GitHub) Action - a feature release introducing optional artifacts

I am happy to announce a new feature release of Spellcheck GitHub 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), 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").

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 (documentation), but curl or similar can be used, consult the referenced documentation for details.

First you configure that you want an artifact:

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
Enter fullscreen mode Exit fullscreen mode

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

output_file: spellcheck-output.txt
Enter fullscreen mode Exit fullscreen mode

Second, you run a test.

gh workflow run "Spellcheck Action"
Enter fullscreen mode Exit fullscreen mode

NB! your name of the spellchech action might vary.

Then you inquire if there are any artifacts.

gh api \
  -H "Accept: application/vnd.github.v3+json" \
  /repos/rojopolis/spellcheck-github-actions/actions/artifacts
Enter fullscreen mode Exit fullscreen mode

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

Then you download the artifact.

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

Unpack the artifact.

unzip artifact.zip
Enter fullscreen mode Exit fullscreen mode

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

cat spellcheck-output.txt
Spelling check passed :)
Enter fullscreen mode Exit fullscreen mode

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.

Change Log

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

  • @riccardoporreca created issue #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.

  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
Enter fullscreen mode Exit fullscreen mode

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

Top comments (1)

Collapse
 
jonasbn profile image
Jonas Brømsø

Okay a funny little anecdote about the above release. It is a GitHub action, running a Docker image, configured using YAML - but fundamentally this is just using the Unix command line tee