Skip to content

Commit f6834b0

Browse files
authored
Merge branch 'main' into improve-http-client
2 parents 55291a1 + 7805bd1 commit f6834b0

2 files changed

Lines changed: 68 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,72 @@ on:
99
permissions:
1010
pull-requests: write
1111

12+
concurrency:
13+
group: ci-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
1216
jobs:
17+
format:
18+
runs-on: ubuntu-latest
19+
name: Auto-format
20+
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
21+
steps:
22+
- uses: actions/checkout@v6
23+
with:
24+
ref: ${{ github.head_ref }}
25+
token: ${{ secrets.PR_TOKEN }}
26+
27+
- name: Check if last commit is from bot
28+
id: check-bot
29+
run: |
30+
LAST_AUTHOR=$(git log -1 --format='%an')
31+
if [ "$LAST_AUTHOR" = "github-actions[bot]" ]; then
32+
echo "skip=true" >> "$GITHUB_OUTPUT"
33+
else
34+
echo "skip=false" >> "$GITHUB_OUTPUT"
35+
fi
36+
37+
- name: Set up JDK 21
38+
if: steps.check-bot.outputs.skip != 'true'
39+
uses: actions/setup-java@v5
40+
with:
41+
java-version: 21
42+
distribution: 'corretto'
43+
44+
- name: Cache compiled buildscripts
45+
if: steps.check-bot.outputs.skip != 'true'
46+
uses: actions/cache@v5
47+
with:
48+
key: ${{ runner.os }}-gradle-${{ hashFiles('buildSrc/**/*.kts') }}
49+
path: |
50+
./buildSrc/build
51+
52+
- name: Setup Gradle
53+
if: steps.check-bot.outputs.skip != 'true'
54+
uses: gradle/actions/setup-gradle@v6
55+
with:
56+
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
57+
gradle-home-cache-includes: |
58+
caches
59+
60+
- name: Run spotlessApply
61+
if: steps.check-bot.outputs.skip != 'true'
62+
run: ./gradlew spotlessApply
63+
64+
- name: Commit formatting changes
65+
if: steps.check-bot.outputs.skip != 'true'
66+
run: |
67+
if [ -n "$(git status --porcelain)" ]; then
68+
git config user.name "github-actions[bot]"
69+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
70+
git add -A
71+
git commit -m "Auto-format: apply spotless formatting"
72+
git push
73+
fi
74+
1375
build:
76+
needs: [format]
77+
if: always() && !cancelled()
1478
runs-on: ${{ matrix.os }}
1579
name: Java ${{ matrix.java }} ${{ matrix.os }}
1680
strategy:

core/src/main/java/software/amazon/smithy/java/core/VersionCheck.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
public final class VersionCheck {
3232
private static final InternalLogger LOGGER = InternalLogger.getLogger(VersionCheck.class);
33-
private static final String SKIP_PROPERTY = "smithy.java.skipVersionCheck";
33+
private static final String SKIP_VERSION_CHECK_PROPERTY = "smithy.java.skipVersionCheck";
3434
private static final AtomicBoolean CHECKED = new AtomicBoolean(false);
3535

3636
private VersionCheck() {}
@@ -47,11 +47,11 @@ public static void check(ModuleVersion codegenVersion) {
4747
if (CHECKED.get()) {
4848
return;
4949
}
50-
if (Boolean.getBoolean(SKIP_PROPERTY)) {
50+
if (Boolean.getBoolean(SKIP_VERSION_CHECK_PROPERTY)) {
5151
LOGGER.warn("Smithy Java version compatibility check is disabled via '{}'. "
5252
+ "This is not recommended and should only be used as a temporary workaround. "
5353
+ "Running with mismatched module versions may cause unexpected runtime errors.",
54-
SKIP_PROPERTY);
54+
SKIP_VERSION_CHECK_PROPERTY);
5555
CHECKED.set(true);
5656
return;
5757
}
@@ -120,4 +120,5 @@ public static void check(ModuleVersion codegenVersion) {
120120
static void reset() {
121121
CHECKED.set(false);
122122
}
123+
123124
}

0 commit comments

Comments
 (0)