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

Save only when new images were created #82

Merged
merged 1 commit into from
Dec 6, 2020
Merged

Conversation

rcowsill
Copy link
Contributor

@rcowsill rcowsill commented Dec 5, 2020

As described in #81, this action often saves a new cache even though no new images were created. This happens when there were images preloaded and then the action restored a cache successfully.

In that case, checkIfImageHasAdded returns true because existingImages includes the preloaded images as well as the restored ones. That bypasses this check:

if (await imageDetector.checkIfImageHasAdded(restoredImages)) {

Then getImagesShouldSave returns the list of restored images, so the next check passes because imagesToSave isn't empty.

if (imagesToSave.length < 1) {

This change ignores restored images when checking if new images were created. When new image(s) are detected they're saved with the restored images in the new cache. This is so that unchanged images aren't lost when other images are rebuilt.

Fixes #81

Ignore restored images when checking for new images. Restored
images are still always added to the new cache. This is so that
unchanged images aren't lost when other images are rebuilt.
@sonarcloud
Copy link

sonarcloud bot commented Dec 5, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Owner

@satackey satackey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rcowsill Thank you!

@satackey satackey merged commit 94f1bef into satackey:master Dec 6, 2020
@rcowsill rcowsill deleted the fix/81 branch December 6, 2020 18:05
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

Successfully merging this pull request may close these issues.

Restored images are treated as new images
2 participants