swift-format is only one of several options for Swift language formatting tools, but as it is part of the official Swift GitHub organization and is built by Apple, it stands a good chance of coming out as the primary one. As of Xcode 16, swift-format is bundled with Apple’s IDE for Swift development both as a CLI tool and a toolbar action.
That means that rather than needing a special GitHub Marketplace Action or Docker container to run swift-format, we can now run it almost directly—only needing to pass the command to xcrun to get things running. Here’s the full Workflow job which can be added on its own as a YAML file inside of a projects .github/workflows/ directory or combined with other Workflow definitions if you’ve already got some.
That will check out your code in a macOS 15 container (required, I believe, to have access to Xcode 16 which is the first version where this will work) and run swift-format’s lint subcommand in parallel across all files, failing the step if there are any warnings.