Skip to content

Commit

Permalink
Add github actions to check POM file are well formatted.
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
sbernard31 committed Jul 13, 2022
1 parent 03770f8 commit 3cca2cd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/actions/sortpom/action.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 3cca2cd

Please sign in to comment.