diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml
new file mode 100644
index 00000000000..7cf702aac36
--- /dev/null
+++ b/.github/workflows/lint-code.yml
@@ -0,0 +1,42 @@
+name: Automatically lint code
+
+on: [pull_request]
+
+permissions:
+ pull-requests: 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: 21
+ - 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:check
+ - name: "Comment if failure"
+ if: failure()
+ env:
+ GITHUB_URL: ${{ github.event.pull_request.comments_url }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ export JSON_DATA=$(jq --null-input --arg body "Lint failure. Please " '{ "body": $body }')
+ curl -X POST \
+ $GITHUB_URL \
+ -H "Content-Type: application/json" \
+ -H "Authorization: token $GITHUB_TOKEN" \
+ --data "${JSON_DATA}"
+
diff --git a/pom.xml b/pom.xml
index 3c71f71a239..127beff5a24 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,6 +35,8 @@
https://github.com/apache/dubbo
2011
+
+
The Apache Software Foundation
http://www.apache.org/