Can't clear Swift build cache, and it keeps using an old commit of a dependency

I’m trying to build a website from a PR, specifically this one: Switching to Saga by kevinrenskers · Pull Request #2 · loopwerk/ · GitHub. This is a Swift project that also depends on some Python packages. The problem is that this Swift package depends on another package, to a specific branch. And Netlify keeps checking out an older commit, not the latest commit of that branch.

This is my Package.swift:

// swift-tools-version:5.2
import PackageDescription

let package = Package(
  name: "Loopwerk",
  dependencies: [
    .package(name: "Saga", url: "", .branch("SwiftMarkdown")),
  targets: [
      name: "Loopwerk",
      dependencies: ["Saga"]),

When you look at, you can see that the latest commit has hash 192753e9475bff3ead679c83883f57ef3087ce5f. Yet in the build log this error keeps happening:

9:54:46 PM: 5.2 has been installed.
9:54:46 PM: Using Swift version 5.2
9:54:46 PM: Building Swift Package
9:54:46 PM: Started restoring cached swift build
9:54:46 PM: Finished restoring cached swift build
9:54:48 PM: Fetching
9:54:49 PM: @ 99ae70723ac84ed96291f36e659e554ba5a0ed40: error: package at '' @ 99ae70723ac84ed96291f36e659e554ba5a0ed40 is using Swift tools version 5.3.0 but the installed version is 5.2.0
9:54:49 PM: Error building Swift package

Even when I re-run the build with the clean cache option, it keeps restoring the cached Swift build, and keeps using that 99ae70723ac84ed96291f36e659e554ba5a0ed40 commit.

It also redownloads Swift 5.2 (a 369M download, taking 40+ seconds) for each and every build. Is that expected? :thinking:

Never mind, I found out what was causing it: Package.resolved was still pointing to that older release.

Hi, @Loopwerk. Thanks for taking the time to loop back to share the solution you found.

This prevents the “denvercoder9” scenario and no one likes that:

Again, @Loopwerk. Thank you for taking the time to post the solution so future web searchers don’t yell at their monitors. :wink: