Alternative to actions/cache that does not require node
Find a file
Joshua Behrens 1bf45d0a0e
All checks were successful
Check / check (push) Successful in 4s
Add caching alternative to actions/cache
2026-11-27 17:51:46 +01:00
.forgejo/workflows Add caching alternative to actions/cache 2026-11-27 17:51:46 +01:00
.editorconfig Add caching alternative to actions/cache 2026-11-27 17:51:46 +01:00
action.yml Add caching alternative to actions/cache 2026-11-27 17:51:46 +01:00
README.md Add caching alternative to actions/cache 2026-11-27 17:51:46 +01:00
renovate.json Add caching alternative to actions/cache 2026-11-27 17:51:46 +01:00
tool-cache Add caching alternative to actions/cache 2026-11-27 17:51:46 +01:00

Tool cache

A Forgejo Actions composite action that restores and saves a directory in the cache of the Forgejo runner. It runs one bash step with curl, tar and sed, so the job container needs no node.

jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            -   name: Restore the tool cache
                id: restore
                uses: https://git.tweecore.cloud/actions/caching@v1.0.0
                with:
                    mode: restore
                    key: dev-ops-tool-cache-${{ hashFiles('Makefile') }}
                    path: .dev-ops/var/cache/download

            -   name: Save the tool cache
                if: steps.restore.outputs.cache-hit != 'true'
                uses: https://git.tweecore.cloud/actions/caching@v1.0.0
                with:
                    mode: save
                    key: dev-ops-tool-cache-${{ hashFiles('Makefile') }}
                    path: .dev-ops/var/cache/download
  • restore prints a notice and continues on a miss or when the runner offers no cache, and sets the output cache-hit.
  • save fails when the runner offers no cache (ACTIONS_CACHE_URL is empty); enable cache.enabled in the configuration of the Forgejo runner.
  • Use the same path for restore and save, as given: the entry belongs to that path, so another spelling of the same directory misses.
  • Only this action reads its own entries: caches saved by actions/cache are not restored.