Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow only using the magic-nix-cache is a secret isn't set #19

Open
icewind1991 opened this issue Jul 8, 2023 · 1 comment
Open

Allow only using the magic-nix-cache is a secret isn't set #19

icewind1991 opened this issue Jul 8, 2023 · 1 comment

Comments

@icewind1991
Copy link

icewind1991 commented Jul 8, 2023

I already have a external nix cache for actions which works great but can't be used by external PR's/forks.

magic-nix-cache does work for forks but doesn't do cross-branch caching and can hit github's rate limits.

Ideally I would configure my action to use the external cache for any job that has access to the required secrets and fallback to magic-nix-cache for any job that doesn't.

I could just always enable the magic-nix-cache but it seems wasteful to put extra load on github's cache when the external cache is available.
It is also possible to make steps conditional based on the availability of secrets, it's a bit cumbersome requires more boilerplate that I would like to have to repeat for every job.

It would be nice the the magic-nix-cache action has a builtin option to check for the availability of secrets and disable itself when the secret is set. Something like:

steps:
  - uses: DeterminateSystems/magic-nix-cache-action@main
    with:
      skipIf: ${{ secrets.ATTIC_TOKEN }}

would make it easy to get a "best of both worlds" caching setup with minimal boilerplate.

@phated
Copy link

phated commented Jul 9, 2023

why can't you use if: on your step?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants