mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-27 08:36:38 +00:00
49 lines
1.3 KiB
YAML
49 lines
1.3 KiB
YAML
|
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
|