Files
hapi-fhir-jpaserver-starter/.github/workflows/spotless-check.yml
Martin Bernstorff 5585170c7d ci: remove success message from formatting check (#858)
* ci: remove success message from formatting check

The workflow succeeds giving a green check-mark next to the commit id. Perhaps writing a comment each time is redundant?

E.g.: https://github.com/hapifhir/hapi-fhir-jpaserver-starter/pull/856

* Update spotless check workflow to handle failures

Modify condition for PR comment action to run only on failure.
2025-09-16 22:05:08 +02:00

35 lines
1.3 KiB
YAML

name: mvn spotless:check (Formatting)
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
format-check:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: spotless:check
run: mvn spotless:check
- uses: mshick/add-pr-comment@v2
# Only run if the previous step failed
if: failure() && steps.spotless_check.outcome == 'failure'
with:
proxy-url: https://slack-bots.azure.smilecdr.com/robogary/github
message-success: |
Formatting check succeeded! This should never run, because the step is skipped on workflow success.
message-failure: |
**This Pull Request has failed the formatting check**
Please run `mvn spotless:apply` or `mvn clean install -DskipTests` to fix the formatting issues.
You can automate this auto-formatting process to execute on the git pre-push hook, by installing [pre-commit](https://pre-commit.com/) and then calling `pre-commit install --hook-type pre-push`. This will cause formatting to run automatically whenever you push.