-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: only cache if the SDK is not yet cached #187
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks PR!
This is a great change!
I didn't know about lookupOnly!
Please see I commented Suggestion
src/cache.ts
Outdated
core.info(`checking if "${restoreKey}" is already cached ...`) | ||
const hasEntry = await cache.restoreCache([ANDROID_HOME_DIR], restoreKey, [], { lookupOnly: true }) | ||
if (hasEntry) { | ||
core.info(`Found in cache: ${restoreKey}`) | ||
return | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core.info(`checking if "${restoreKey}" is already cached ...`) | |
const hasEntry = await cache.restoreCache([ANDROID_HOME_DIR], restoreKey, [], { lookupOnly: true }) | |
if (hasEntry) { | |
core.info(`Found in cache: ${restoreKey}`) | |
return | |
} | |
core.info(`checking if "${restoreKey}" is already cached ...`) | |
const hasEntry = await cache.restoreCache([ANDROID_HOME_DIR], restoreKey, [], { lookupOnly: true }) | |
if (hasEntry) { | |
core.info(`Found in cache: ${restoreKey}`) | |
return | |
} | |
core.info(`caching "${restoreKey}" ...`) | |
return await cache.saveCache([ANDROID_HOME_DIR], restoreKey) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you suggesting that I remove the catch on ReserveCacheError
? 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
I did not know how to check if the cache already exists.
So, if I did a cache and got a ReserveCacheError, it meant that the cache was already there.
please run |
and check the lint error(prettier) |
Thanks for your PR! |
https://github.com/amyu/setup-android/releases/tag/v3.3 |
Thank you! |
No description provided.