On Fri Jul 17, 2026 at 3:06 PM CEST, Andres Freund wrote:
> It'd be nice if we could restore the cache for the "base branch" of a branch,
> instead of master, but that's not currently possible in GHA, from what I can
> tell. Only caches on the default branch are accessible to other branches.
Hmm... The GHA permission model seems to be more complex every time I
look into it.... It's indeed not possible to restore caches from
non-default branches, *except* if the workflow was triggered by a PR and
that PR tries to restore a cache from the base branch of the PR.
So attached is something that makes this work as long as you open a PR
against the respective release branch. The more complex logic is
actually the part that cancels the branch build to make sure that you
don't run push and PR workflows at the same time.
After implementing that I think there's another approach possible too:
Allow users to trigger a cache build workflow *from the master branch*
that builds the cache for specific release branches (by checking them
out and building them).