diff --git a/.github/actions/sortpom/action.yml b/.github/actions/sortpom/action.yml new file mode 100644 index 0000000000..09c5503333 --- /dev/null +++ b/.github/actions/sortpom/action.yml @@ -0,0 +1,39 @@ +name: "Check POM Formatting" +description: "Check pom.xml file are well formatted with Maven" + +runs: + using: "composite" + steps: + + - name: Check POM formatting + id: sort_pom + shell: bash + run: mvn -B com.github.ekryd.sortpom:sortpom-maven-plugin:verify -PallPom + + - name: Add comment + if: failure() + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: POM Formatting check Failed + message: | + :x: **Pom.xml files are not well formatted !** [(more details)](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) + + Ensure your code build locally using: + ``` + mvn clean install + ``` + Or just validate pom formatting with : + ``` + mvn com.github.ekryd.sortpom:sortpom-maven-plugin:verify -PallPom + ``` + You can format pom.xml file with : + ``` + mvn com.github.ekryd.sortpom:sortpom-maven-plugin:sort -PallPom + ``` + + - name: Delete comment + if: success() + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: POM Formatting check Failed + delete: true \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 210a686d6f..d1c8966c7a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,6 +30,11 @@ jobs: - name: Check No Merge Commit uses: ./.github/actions/no_merge + - name: POM Format Check + if: always() + id: sortpom + uses: ./.github/actions/sortpom + - name: Code Format Check if: always() id: formatter diff --git a/pom.xml b/pom.xml index 4bf4fd5101..c27b17275f 100644 --- a/pom.xml +++ b/pom.xml @@ -482,6 +482,7 @@ Contributors: <formatter.skip>true</formatter.skip> <checkstyle.skip>true</checkstyle.skip> <impsort.skip>true</impsort.skip> + <sort.skip>true</sort.skip> </properties> </profile> </profiles>