Skip to content

Commit

Permalink
ci: update github action to format code before building on each push
Browse files Browse the repository at this point in the history
  • Loading branch information
rexlManu committed Feb 6, 2024
1 parent 9bea08e commit 56b7742
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ on:
pull_request:

jobs:
formatting:
name: Format code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- run: chmod +x gradlew
- name: Build project
run: ./gradlew spotlessApply
- name: Commit changes
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "style: format code with spotless"
git push
build:
name: Build
runs-on: ubuntu-latest
Expand All @@ -26,14 +48,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: plugin-files
path: build/libs/*.jar
formatting:
name: Format code
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: axel-op/googlejavaformat-action@v3
with:
args: "--skip-sorting-imports --replace"
commit-message: "style: apply google-java-format"
path: build/libs/*.jar

0 comments on commit 56b7742

Please sign in to comment.