setup-swift icon indicating copy to clipboard operation
setup-swift copied to clipboard

Add soft-fail-version-check toggle to warn (not error) on untested Swift versions

Open escii opened this issue 9 months ago • 1 comments

This PR introduces a new boolean input, soft-fail-version-check, which defaults to false. When set to true, the action will:

  • Emit a warning instead of throwing an error when the requested Swift version isn’t found in the list of tested versions.
  • Attempt to download/install the exact version string provided

This makes it possible to consume patch/minor releases (e.g. 6.1.1) as soon as they’re available upstream, without having to wait for the action’s static list to be updated. #743 #706 #683 #672

Changes: action.yml

  • Added soft-fail-version-check input (default: false)

src/swift-versions.ts

  • Read soft-fail-version-check via core.getInput(...)
  • In verify(...), replace the hard error on missing version with:
if (softFailVersionCheck) {
  core.warning(
    `Swift version "${version}" not in the list of tested versions; proceeding anyway because soft-fail-version-check is enabled.`
  );
  return version;
}
throw new Error(`Version "${version}" is not available`);

Tests: Added a matrix job in our test workflow to verify all three behaviors:

  • Default (fails on unknown versions)
  • With soft-fail-version-check: true (warns and proceeds)
  • With soft-fail-version-check: true (warns and proceeds) but then fails because the version 6.1.6 does not exist.

You can see the matrix runs here: https://github.com/sonderformat-llc/setup-swift-test/actions/runs/15975074977

escii avatar Jun 30 '25 14:06 escii

@fwal what do you think about this workaround?

Aaron-Ritter avatar Jul 09 '25 08:07 Aaron-Ritter