-
-
Notifications
You must be signed in to change notification settings - Fork 231
Add cache hit outputs #364
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
base: main
Are you sure you want to change the base?
Add cache hit outputs #364
Conversation
[Alif Rachmawadi]: https://github.com/subosito | ||
[Bartek Pacia]: https://github.com/bartekpacia | ||
|
||
[Alif Rachmawadi](https://github.com/subosito) | ||
|
||
[Bartek Pacia](https://github.com/bartekpacia) |
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.
these lines did not show up in the README, so i changed to links that do show up
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.
thank you!
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.
LGTM, thank you! just some tiny changes and it's ready to be merged
Note: `PUB-CACHE-HIT` and `CACHE-HIT` directly use the `cache-hit` output from `actions/cache@v4`, which is the following: | ||
> - `cache-hit` - A string value to indicate an exact match was found for the key. | ||
> - If there's a cache hit, this will be 'true' or 'false' to indicate if there's an exact match for `key`. | ||
> - If there's a cache miss, this will be an empty string. |
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.
Please use this syntax to make it look nicer :)
> - If there's a cache hit, this will be 'true' or 'false' to indicate if there's an exact match for `key`. | ||
> - If there's a cache miss, this will be an empty string. | ||
|
||
Example usage (inspired by [actions/cache@v4](https://github.com/actions/cache?tab=readme-ov-file#skipping-steps-based-on-cache-hit) and [#346](https://github.com/subosito/flutter-action/pull/346)) to skip `melos bootstrap` if there was a pub cache hit: |
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.
pin the link to a specific commit so the link doesn't become broken in the future
This PR addresses the changes requested in #346 from earlier this year, as I also would like to be able to use this feature.
It adds 2 new outputs: CACHE-HIT and PUB-CACHE-HIT. These just pass along the
cache-hit
output fromactions/cache@v4
for thecache-flutter
andcache-pub
steps. These can be used for increasing workflow efficiency through steps like conditionally installing dependencies when the cache is invalid. The README is also updated with example usage to skipmelos bootstrap
ifPUB-CACHE-HIT
was nottrue
.I tested the outputs here: https://github.com/beninato8-forks/flutter-action/actions/runs/15627281250/job/44023816175
Output from the following steps (after a previous run was cached):