@@ -5,6 +5,8 @@ You are an automated assistant that takes the current uncommitted changes in the
55## Prerequisites
66
77- The workspace must be a git repository with a configured remote named ` origin ` .
8+ - The project must be compiling successfully with the current changes (if applicable).
9+ - The project must be building successfully with the current changes (if applicable).
810- There must be uncommitted changes (staged or unstaged) in the working tree.
911- The GitHub MCP tools must be available for creating and merging pull requests.
1012
@@ -29,7 +31,7 @@ eval "$(.github/scripts/ci/parse-repo-info.sh)"
2931# Sets: REPO_OWNER, REPO_NAME
3032```
3133
32- ### Step 2: Auto-detect branch name and commit message
34+ ### Step 2: Auto-detect branch name and define commit message
3335
3436Analyze the changed files using ` git diff ` (and ` git diff --cached ` for staged changes) to understand what was modified. Generate:
3537
@@ -40,7 +42,19 @@ Analyze the changed files using `git diff` (and `git diff --cached` for staged c
4042
4143If the user has provided an explicit branch name or commit message, use those instead.
4244
43- ### Step 3: Commit and push
45+ ### Step 3: Verify the project builds
46+
47+ If the changes include Java source files, run the build to confirm the project compiles and tests pass:
48+
49+ ``` bash
50+ mvn clean verify
51+ ```
52+
53+ If only non-Java files changed (e.g., documentation, scripts, configuration), this step may be skipped.
54+
55+ ** Stop immediately if the build fails.** Do not proceed to commit broken code.
56+
57+ ### Step 4: Commit and push
4458
4559Runs the formatter (if applicable), creates the branch, stages all changes, commits, and pushes:
4660
@@ -51,27 +65,27 @@ Runs the formatter (if applicable), creates the branch, stages all changes, comm
5165
5266Pass ` --skip-format ` as a third argument to skip ` mvn spotless:apply ` (e.g., when only non-Java files changed).
5367
54- ### Step 4 : Create a pull request
68+ ### Step 5 : Create a pull request
5569
5670Use the GitHub MCP ` create_pull_request ` tool with:
5771
5872- ** owner** and ** repo** : from Step 1
5973- ** title** : the first line of the commit message
60- - ** head** : the branch name from Step 3
74+ - ** head** : the branch name from Step 4
6175- ** base** : ` main ` (or the repository's default branch)
6276- ** body** : A well-structured PR description including:
6377 - ** Summary** : What the change does and why
6478 - ** Changes** : Bullet list of files/areas modified
6579 - ** Testing** : How the changes were verified
6680
67- ### Step 5 : Merge the pull request
81+ ### Step 6 : Merge the pull request
6882
6983Use the GitHub MCP ` merge_pull_request ` tool with:
7084
7185- ** merge_method** : ` squash `
7286- ** commit_title** : ` <PR title> (#<PR number>) `
7387
74- ### Step 6 : Sync and clean up
88+ ### Step 7 : Sync and clean up
7589
7690``` bash
7791.github/scripts/ci/sync-after-merge.sh " <branch-name>"
0 commit comments