cake-build / cake-action

:cake::octocat: Run Cake (C# Make) scripts in your GitHub Actions workflows.
https://cakebuild.net
MIT License
45 stars 13 forks source link

1.1.0 broke version parameter #9

Closed devlead closed 4 years ago

devlead commented 4 years ago

https://github.com/ecampidoglio/cake-action/commit/cbd362d47a8ef17fbc4a3af64d1e7330842b09cf#diff-6a7166c4d6d46136f0efc2a724763a85R37

+    if (version && !targetDirectory.containsToolWithVersion(packageId, version)) {
+          throw new Error(`Failed to uninstall previous version of ${packageId}. Exit code: ${uninstallExitCode}`);
+      await DotNet.uninstallLocalTool(packageId, targetDirectory);

Before it checked if cake was installed and then checked if version was specified and uninstalled.

ecampidoglio commented 4 years ago

@devlead I'm not sure I follow. What do you mean by "broke version parameter"? These tests pass:

✅ Run with a specific Cake version ✅ Run with a different Cake version in the same build

Could you please provide a test that demonstrates the problem?

devlead commented 4 years ago

They pass because you don't run them from a clean state, previous task installed cake so it works.

If you only have one cake task it'll fail because no cake previously installed.

Before above change, uninstall code only executed with in an if block that already checked that cake was installed.

devlead commented 4 years ago

Example execution: https://github.com/devlead/cake/commit/ba16d5ae915d7373302b81726348516d985eeded/checks?check_suite_id=313750612#step:3:8

Original commit rebased away but same as below but with version specified https://github.com/cake-build/cake/blob/7494c7e64e4a00e58acceef4e02d6e4e3efc9695/.github/workflows/build.yml#L20

ecampidoglio commented 4 years ago

@devlead Gotcha! Thank you for reporting this. 👍 I'll take care of it and make a new release.