flutter-action icon indicating copy to clipboard operation
flutter-action copied to clipboard

Problem with cache key passed to `@actions/cache`

Open triallax opened this issue 2 years ago • 1 comments

In this line: https://github.com/subosito/flutter-action/blob/0c3f14223a08fa950c8a4c00bcfb834e65744135/action.yml#L38

The flutter-version passed to the action is appended to the key passed to actions/cache, which is okay, except for the fact that the version may be something like 3.x, which creates some issues:

Say when the action was first run, Flutter 3.0.0 was installed and cached. Flutter 3.3.0 is released, and then the action is run again. Instead of using the newly-released Flutter 3.3.0, the action will use the cached Flutter 3.0.0 instead.

This problem can be fixed by appending the actual version of Flutter installed instead, or by invalidating the cache when a newer version is available.

triallax avatar Jun 04 '22 12:06 triallax

@mhmdanas Hello! In that case, surely, an additional cache key should be given, at least in the current version. Something like this,

steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@main
  with:
    flutter-version: 'any'
    channel: 'stable'
    cache: true
    cache-key: '2022-06-07' ## Manually Update this `key`
- run: flutter --version

KKimj avatar Jun 07 '22 06:06 KKimj

We now support dynamic cache-key and cache-path https://github.com/subosito/flutter-action/blob/main/action.yml#L23 to cover this issue. Please reopen if the issue persists.

subosito avatar Aug 25 '22 13:08 subosito