Skip to content

Commit b48562b

Browse files
authored
Create new workflow to apply spotless. (#202)
* Create new workflow to apply spotless. * License header.
1 parent fdc1b8e commit b48562b

File tree

2 files changed

+49
-5
lines changed

2 files changed

+49
-5
lines changed

.github/workflows/apply_spotless.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
name: Apply spotless
15+
16+
on:
17+
pull_request:
18+
branches: [ '*' ]
19+
workflow_dispatch:
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
25+
jobs:
26+
apply-spotless:
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 30
29+
if: github.repository == 'android/snippets'
30+
31+
steps:
32+
- name: Checkout Repository
33+
uses: actions/checkout@v3
34+
with:
35+
token: ${{ secrets.PAT || github.token }}
36+
37+
- name: set up Java 17
38+
uses: actions/setup-java@v2
39+
with:
40+
distribution: 'zulu'
41+
java-version: '17'
42+
43+
- name: Run spotlessApply
44+
run: ./gradlew :compose:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
45+
46+
- name: Auto-commit if spotlessApply has changes
47+
uses: stefanzweifel/git-auto-commit-action@v4
48+
with:
49+
commit_message: Apply Spotless

.github/workflows/build.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ jobs:
3737
with:
3838
distribution: 'zulu'
3939
java-version: '17'
40-
- name: Apply formatting if failed
41-
run: ./gradlew :compose:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
42-
- uses: stefanzweifel/git-auto-commit-action@v4
43-
with:
44-
commit_message: Apply Spotless
4540
- name: Build Compose
4641
run: ./gradlew :compose:snippets:build
4742
- name: Build recompose snippets

0 commit comments

Comments
 (0)