forked from apache/dubbo
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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 | ||