LightAndLight / ipso

A functional scripting language.
https://ipso.dev
16 stars 1 forks source link

GitHub Actions cache isn't shared across branches #338

Closed LightAndLight closed 1 year ago

LightAndLight commented 1 year ago

I noticed a cache miss (https://github.com/LightAndLight/ipso/actions/runs/4098584146/jobs/7067800203#step:15:20) even though the cache key existed: github-actions-caches

I learned that caches aren't actually shared between branches: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache, so if a pull request creates a cache key, then a subsequent pull request can't access that key.

It seems that branches can access the cache keys of main, so this might mean I have to run the tests.yml workflow for main so that pull requests can use the cache properly:

on:
  push:
    branches:
      - main