flatpak-github-actions icon indicating copy to clipboard operation
flatpak-github-actions copied to clipboard

Do not error if the cache already exists

Open rkoesters opened this issue 2 years ago • 4 comments

If a build is able to successfully load a cache, then it will produce an error trying to save a cache with that same key. See the "Annotations" section in https://github.com/rkoesters/xkcd-gtk/actions/runs/1352160876 as an example.

The error is ReserveCacheError and it would be better to log an info message that says the cache already exists instead of an error message. Otherwise, anytime the cache is successfully used, errors are reported.

rkoesters avatar Oct 17 '21 20:10 rkoesters

That's an upstream issue. We can't do much about it

bilelmoussaoui avatar Oct 20 '21 06:10 bilelmoussaoui

It is not an upstream issue, because this line of code does it: https://github.com/bilelmoussaoui/flatpak-github-actions/blob/master/flatpak-builder/index.js#L155

If that line was deleted then errors would not surface to the GitHub Actions dashboard for a run (although checking the error type and then conditionally reporting an error is likely better behavior).

I'm not really familiar with Javascript, but I think it should be possible to check whether the thrown reason exception is of type ReserveCacheError and then not calling core.error (maybe core.info('Cache already exists, not saving.') or something). Otherwise (if reason is not ReserveCacheError) then the code can call core.error with the full error message for the user to see.

Thank you!

rkoesters avatar Oct 20 '21 14:10 rkoesters

The issue you're hitting is https://github.com/actions/toolkit/issues/658 and we can't do much about it actually

bilelmoussaoui avatar Nov 23 '21 16:11 bilelmoussaoui

ideally such error wouldn't happen and the build would work just fine

bilelmoussaoui avatar Nov 23 '21 16:11 bilelmoussaoui