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

The latest Cake version is not always honoured

Open ecampidoglio opened this issue 9 months ago • 0 comments

Background

Running the action without specifying the --cake-version input parameter implies installing the latest version of the Cake.Tool package. This is achieved by running dotnet tool install without the --version parameter.

The Problem

While this approach works fine in most cases, there's one scenario where it falls short: when the action runs on an agent where a different version of the Cake.Tool package is already installed.

Here's an example workflow:

  1. The Cake action runs with the --cake-version set to x.y.z
  2. Version x.y.z of the Cake.Tool is installed in the tools directory
  3. The Cake action runs again, only this time without the --cake-version input parameter implying that the latest version of Cake should be used
  4. The action sees that the Cake.Tool is already present in the tools directory; however, without a specific version number to compare with, it determines that it shouldn't install any new version of the Cake.Tool and runs with it
  5. The user thinks that the action is running with the latest version of Cake, while in reality it's running with whatever version was alreaady installed in the tools directory

Proposed Solution

When running the action without the --cake-version input parameter, the action should go out and fetch the latest version of the Cake.Tool from the Cake releases on GitHub and use that as the version number.

This way, there will always be a version number to compare with when determining whether any existing installation of the Cake.Tool can be used.

Risks

In the case when fetching the latest version from GitHub fails for some reason (e.g. due to a network error), the action should simply fall back to the previous behavior of installing the Cake.Tool without a version number.

ecampidoglio avatar Apr 26 '24 07:04 ecampidoglio