GitHub action to install Elm tools and cache ELM_HOME
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Matthieu Pizenberg cbc43aedc6
Bump version to 2.1.0
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com>
2026-07-14 14:09:16 +02:00
.github/workflows Upgrade elm-tooling-cli to v1.20.0 2026-07-14 13:57:09 +02:00
dist Upgrade elm-tooling-cli to v1.20.0 2026-07-14 13:57:09 +02:00
src Upgrade deps and migrate to ESM/node24 (v2) 2026-07-06 18:44:43 +02:00
action.yml Upgrade deps and migrate to ESM/node24 (v2) 2026-07-06 18:44:43 +02:00
elm-tooling.json Upgrade elm-tooling-cli to v1.20.0 2026-07-14 13:57:09 +02:00
package-lock.json Bump version to 2.1.0 2026-07-14 14:09:16 +02:00
package.json Bump version to 2.1.0 2026-07-14 14:09:16 +02:00
README.md Upgrade elm-tooling-cli to v1.20.0 2026-07-14 13:57:09 +02:00

Elm tooling action

Warning: do not use this if you have a JavaScript package.json already. In such cases, follow instead the default npm-based CI setup as described here: https://elm-tooling.github.io/elm-tooling-cli/ci/

This action lets you install tools supported by elm-tooling, such as elm, elm-format, elm-json and elm-test-rs in your GitHub CI, without the need of npm and package.json.

It will also cache your home Elm directory, as defined by the ELM_HOME environment variable, for more efficient builds! You can use this action as follows.

v2 note: This action runs on the node24 runtime. Use a runner that ships Node.js 24 (GitHub-hosted runners do). If you are on an older runner without Node 24, stay on @v1.

      - name: Install elm, elm-format and cache the ELM_HOME directory
        uses: mpizenberg/elm-tooling-action@v2
        with:
          cache-key: elm-home-${{ hashFiles('elm-tooling.json', 'elm.json') }}

      - name: Making sure the installation worked
        run: elm --version

Where your elm-tooling.json file states your elm and tools versions as specified in the elm-tooling.json. It should look like follows.

{
  "tools": {
    "elm": "0.19.2",
    "elm-format": "0.8.8"
  }
}

Advanced usage

There are two additional keys providing more flexibility for some use cases.

  1. cache-restore-key: A key for restoring the cache if no cache hit occurred for cache-key.
  2. elm-tooling-dir: The directory containing the elm-tooling.json file. If not provided, it defaults to the project root.
      - uses: mpizenberg/elm-tooling-action@v2
        with:
          cache-key: elm-home-${{ hashFiles('elm-tooling.json', 'elm.json') }}
          cache-restore-key: elm-home
          elm-tooling-dir: some/sub/directory

Caching effectively

For security reasons, GitHub actions only have access to caches created in the current branch, a parent branch or the main branch. So if you want cache hits in the first push of your PR branches, a matching cache (primary or restoration key) must have been created in the main branch before. So I'd suggest running your CI both on PR and on a push to the main branch.

More info regarding cache restriction is available on GitHub docs.

Notes

Internally, what this does is calling elm-tooling install from the elm-tooling-dir directory or the root directory if that is not defined. This means it will install the tools somewhere in ELM_HOME/elm-tooling/, add links to those tools in elm-tooling-dir/node_modules/.bin/, and then we add elm-tooling-dir/node_modules/.bin to the PATH so that the executables become available to you.