tailscale / gitops-acl-action

GitOps for your Tailscale ACLs
81 stars 24 forks source link

Only cache version-cache.json and create a new cache key on each run #8

Closed jonwes closed 1 year ago

jonwes commented 2 years ago

I have updated the workflow in the readme. I have made changes to key and restore-keys in the step "Fetch old version info" in addition to path as suggested by @GingerGeek in #7. If we do not supply a new key on each run the new hash will not be stored since github actions caches are immutable, I think.

jonwes commented 2 years ago

We should probably delete old actions caches after a while but they are only ~245 bytes each.

jonwes commented 2 years ago

I updated my PR replacing "github.run_id" with "hashFiles('policy.hujson')" in the hash key so we only get a new key when there is a change in the policy file.

jonwes commented 2 years ago

I went back to using github.run_id in the cache key. Using a hash of the policy file in the cache key does not work as intended if the policy file is restored to an earlier version. I have pushed an updated version of the file README.md. GitHub will remove any cache entries that have not been accessed in over 7 days so using the cache may not be very helpful if the policy file is updated infrequently.

raggi commented 1 year ago

Thank you for this contribution!

I caught up with this issue today and prepared a PR that included this fix alongside another.