[WIP] Test auto lint #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Automatically lint code | |
on: [pull_request] | |
permissions: | |
contents: write | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.dubbo-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 8 | |
- uses: actions/cache@v3 | |
name: "Cache local Maven repository" | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }} | |
restore-keys: | | |
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
${{ runner.os }}-maven- | |
- name: "Lint with Maven" | |
run: | | |
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast spotless:apply | |
- name: Check for changes | |
run: git status | |
- name: Commit and push files | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Found changes" | |
git add . | |
git commit -m "Auto lint styles" | |
git push | |
fi | |