Skip to content

Commit 7422a76

Browse files
authored
Update lint CI job to checkout PR merge ref (#277)
* Update lint CI job to checkout PR merge ref * swift-format-ignore: DontRepeatTypeInStaticProperties
1 parent a2e184d commit 7422a76

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,30 @@ jobs:
2020
secrets: inherit
2121

2222
lint:
23-
name: Lint
24-
runs-on: macos-latest
25-
26-
steps:
27-
- uses: actions/checkout@v4
28-
29-
- run: |
30-
swift format lint --strict --recursive .
31-
32-
- name: Suggest fixes (if check fails)
33-
if: failure()
34-
run: |
35-
echo "### Here's how to fix the formatting locally:" >> $GITHUB_STEP_SUMMARY
36-
echo "" >> $GITHUB_STEP_SUMMARY
37-
echo '```bash' >> $GITHUB_STEP_SUMMARY
38-
echo "# Format all Swift files" >> $GITHUB_STEP_SUMMARY
39-
echo 'swift format -i --recursive .' >> $GITHUB_STEP_SUMMARY
40-
echo '```' >> $GITHUB_STEP_SUMMARY
23+
name: Lint
24+
runs-on: macos-latest
25+
26+
steps:
27+
- name: Checkout PR merge ref if called from PR
28+
if: ${{ github.event.pull_request.number }}
29+
uses: actions/checkout@v4
30+
with:
31+
ref: refs/pull/${{ github.event.pull_request.number }}/merge
32+
fetch-depth: 0
33+
34+
- name: Checkout fallback
35+
if: ${{ !github.event.pull_request.number }}
36+
uses: actions/checkout@v4
37+
38+
- run: |
39+
swift format lint --strict --recursive .
40+
41+
- name: Suggest fixes (if check fails)
42+
if: failure()
43+
run: |
44+
echo "### Here's how to fix the formatting locally:" >> $GITHUB_STEP_SUMMARY
45+
echo "" >> $GITHUB_STEP_SUMMARY
46+
echo '```bash' >> $GITHUB_STEP_SUMMARY
47+
echo "# Format all Swift files" >> $GITHUB_STEP_SUMMARY
48+
echo 'swift format -i --recursive .' >> $GITHUB_STEP_SUMMARY
49+
echo '```' >> $GITHUB_STEP_SUMMARY

Sources/Models/LanguageModel.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ extension LanguageModel {
129129
static let valueCache = "valueCache"
130130
// Output keys
131131
static let logits = "logits"
132+
// swift-format-ignore: DontRepeatTypeInStaticProperties
132133
static let presentKeys = "presentKeys"
133134
static let presentValues = "presentValues"
134135
}

0 commit comments

Comments
 (0)