apache / apache/incubator-seata

Improve Spotless Integration: Enhance `CI Workflow`

Open
#7,308 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

In the last PR, there was a suggestion that our `CI` could be more helpful when code style checks fail.
- https://github.com/apache/incubator-seata/pull/7223#discussion_r2015925979

Currently, the CI fails silently without guiding contributors on how to fix the issue.
To improve the developer experience, I propose two enhancements to the CI workflow:

### 1. Prompt contributors when formatting fails
If code formatting does not meet expectations, the workflow should print a clear message such as:

```
Code style check failed. Please run `mvn spotless:apply` locally to fix formatting issues.
```

This behavior is common in projects like Dubbo and helps reduce confusion for new contributors.
- https://github.com/apache/dubbo/blob/7b34ad9c8640480124c5907de9a76460171921e1/.github/workflows/build-and-test-pr.yml#L63-L67

### 2. Auto-format code and commit to PR
IMHO, It would be great if CI workflow to not only check formatting but also apply fixes via `mvn spotless:apply` and push them directly to the PR.

However, I'm not sure whether this is technically feasible. 😅
If anyone in the community has experience with this or knows more about it, your input would be greatly appreciated.

Contributor guide

Open the contributing guide

Research direction

Inspect the relevant .github workflow and the linked PR discussion, then compare the current formatting check with the referenced Dubbo workflow. Run mvn spotless:apply locally to understand the expected behavior; done means CI clearly explains formatting failures and establishes whether safe automatic fixes and commits to PRs are feasible.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, java
Domain
build-system, ci-cd, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.