From d18b4ffdd462a717f4989eeea38b0ed251678241 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Fri, 5 May 2023 18:51:45 -0400 Subject: [PATCH] Add `unstable` and `unstable-quests` to the `build.yml` action & Add a Spotless format action --- .github/workflows/build.yml | 2 ++ .github/workflows/check_code.yml | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/check_code.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb5324141..1fc4d487b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,8 @@ on: branches: - "stable" - "development" + - "unstable" + - "unstable-quests" pull_request: paths: - "**.java" diff --git a/.github/workflows/check_code.yml b/.github/workflows/check_code.yml new file mode 100644 index 000000000..6b875e815 --- /dev/null +++ b/.github/workflows/check_code.yml @@ -0,0 +1,48 @@ +name: "Lint & Format Code" + +on: + workflow_dispatch: ~ + push: + paths: + - "src/main/**.java" + - "**.json" + branches: + - "unstable" + - "unstable-quests" + +jobs: + Format-Code: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: '17' + - name: Cache gradle files + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + ./.gradle/loom-cache + key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle', 'gradle.properties', '**/*.accesswidener') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Format Code + run: ./gradlew && ./gradlew spotlessApply + + - run: git config --global user.name "github-actions" + - run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + - run: git stash + - run: git checkout development + - run: git stash pop || true + + - name: Commit Code Changes + run: git add -u && git commit -m 'Format code [skip actions]' || true + - name: Push Code Changes + run: git push --set-upstream --force origin development