From 4594d961135f4b81f14c98f4719b5992ccb6d53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Thu, 9 Apr 2026 21:10:21 +0200 Subject: [PATCH 1/2] Add SwiftFormat lint check on pull requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Runs swiftformat --lint in a Linux container on every PR using the same BuildTools pin (SwiftFormat 0.56.1) and flags as the local Scripts/swiftformat.sh, so CI stays in sync with `swift run swiftformat` on a developer machine. Fails the check on any violation without rewriting files — contributors fix formatting themselves and push, rather than having CI commit back over their branch. BuildTools/.build is cached by Package.resolved hash to keep subsequent runs fast. --- .github/workflows/lint.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..7af12d9ca --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,33 @@ +name: Lint +run-name: Lint (${{ github.head_ref || github.ref_name }}) + +on: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + swiftformat: + name: SwiftFormat + runs-on: ubuntu-latest + container: swift:6.0 + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Cache SwiftFormat build + uses: actions/cache@v4 + with: + path: BuildTools/.build + key: ${{ runner.os }}-swiftformat-${{ hashFiles('BuildTools/Package.resolved', 'BuildTools/Package.swift') }} + restore-keys: | + ${{ runner.os }}-swiftformat- + + - name: SwiftFormat --lint + run: | + swift run -c release --package-path BuildTools swiftformat . \ + --lint \ + --header "LoopFollow\n{file}" \ + --exclude Pods,Generated,R.generated.swift,fastlane/swift,Dependencies,dexcom-share-client-swift From 31e6b75e497f92bd711832d85593717ac3a1add2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Thu, 9 Apr 2026 21:42:40 +0200 Subject: [PATCH 2/2] Cancel in-flight lint runs when a newer push lands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a concurrency group so rapid successive pushes to a PR branch don't stack up multiple Lint runs — the in-progress run is cancelled as soon as a newer commit arrives. --- .github/workflows/lint.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7af12d9ca..68aa860f6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,6 +5,10 @@ on: pull_request: workflow_dispatch: +concurrency: + group: lint-${{ github.ref }} + cancel-in-progress: true + permissions: contents: read