lint.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. name: Lint
  2. run-name: Lint (${{ github.head_ref || github.ref_name }})
  3. on:
  4. pull_request:
  5. # 'edited' so the lint re-runs when a PR's base branch is changed; otherwise
  6. # retargeting (e.g. main -> dev) leaves the required SwiftFormat check with no
  7. # run on the new base and the PR stays blocked indefinitely.
  8. types: [opened, synchronize, reopened, edited]
  9. workflow_dispatch:
  10. concurrency:
  11. group: lint-${{ github.ref }}
  12. cancel-in-progress: true
  13. permissions:
  14. contents: read
  15. jobs:
  16. swiftformat:
  17. name: SwiftFormat
  18. # Run on open/sync/reopen always; on 'edited' only when the base branch
  19. # actually changed, so routine title/description edits don't re-lint.
  20. if: ${{ github.event.action != 'edited' || github.event.changes.base != null }}
  21. runs-on: ubuntu-latest
  22. container: swift:6.0
  23. steps:
  24. - name: Checkout
  25. uses: actions/checkout@v5
  26. - name: Cache SwiftFormat build
  27. uses: actions/cache@v4
  28. with:
  29. path: BuildTools/.build
  30. key: ${{ runner.os }}-swiftformat-${{ hashFiles('BuildTools/Package.resolved', 'BuildTools/Package.swift') }}
  31. restore-keys: |
  32. ${{ runner.os }}-swiftformat-
  33. - name: SwiftFormat --lint
  34. run: |
  35. swift run -c release --package-path BuildTools swiftformat . \
  36. --lint \
  37. --header "LoopFollow\n{file}" \
  38. --exclude Pods,Generated,R.generated.swift,fastlane/swift,Dependencies,dexcom-share-client-swift