This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch 
we-need-to-add-the-following-rules-when-merging-a
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 3c35165bb7268d109407a0fbbe37fdaccc4c2ca1
Author: Guillaume Nodet <[email protected]>
AuthorDate: Mon Jul 6 07:25:44 2026 +0000

    Add merge procedure rules for AI agents
    
    Document the complete merge workflow: derive milestone from
    target-branch pom.xml, assign milestone/labels/assignees on
    both the PR and JIRA issue, merge, close JIRA, and clean up
    the branch. Rules added to both AGENTS.md and the oss-helper
    project-guidelines so all agent tooling picks them up.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .oss-ai-helper-rules/project-guidelines.md |  8 ++++++
 AGENTS.md                                  | 43 ++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/.oss-ai-helper-rules/project-guidelines.md 
b/.oss-ai-helper-rules/project-guidelines.md
index 2f03203b9b3f..4e88f8b56c4d 100644
--- a/.oss-ai-helper-rules/project-guidelines.md
+++ b/.oss-ai-helper-rules/project-guidelines.md
@@ -17,3 +17,11 @@ This rule file contains branching, commit, PR, and 
task-finding conventions for
 - **Find-task intermediate:** Filter 12352792 (easy issues)
 - **Find-task experienced JQL:** `project = CAMEL AND status = Open AND labels 
= help-wanted` (maxResults=10)
 - **Scope-too-large redirect:** create a Jira issue directly
+- **Merge procedure:**
+  1. Derive milestone from target branch: read `<version>` from root `pom.xml` 
on the target branch and strip `-SNAPSHOT` (e.g., `4.22.0-SNAPSHOT` → `4.22.0`)
+  2. Assign milestone to PR (`gh pr edit <PR> --milestone <version>`) and set 
`fixVersions` on the JIRA issue to the same version (before closing)
+  3. Assign PR to the PR author (`gh pr edit <PR> --add-assignee <author>`) 
and verify JIRA issue is assigned to the contributor
+  4. Categorize PR with labels based on JIRA issue type or PR content: `bug` 
(Bug), `enhancement` (Improvement/New Feature), `documentation` 
(Documentation), `task` (Task/refactoring), `dependency` (dependency upgrades), 
`test` (Test)
+  5. Merge the PR (after verifying human approval and no unresolved 
conversations)
+  6. Close the JIRA issue (transition to Resolved/Fixed, add comment linking 
to merged PR)
+  7. Delete the PR branch
diff --git a/AGENTS.md b/AGENTS.md
index 5d3716fd0a6a..eb57c3b981a2 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -72,6 +72,49 @@ When creating a PR, **always identify and request reviews** 
from the most releva
 - An agent MUST NOT merge a PR without at least **one human approval**.
 - An agent MUST NOT approve its own PRs — human review is always required.
 
+### Merge Procedure
+
+When merging a PR, an agent MUST perform the following steps **in order**:
+
+1. **Derive the milestone from the target branch**:
+   - Read the `<version>` from the root `pom.xml` on the PR's **target 
branch** (e.g., `main`,
+     `camel-4.18.x`).
+   - Strip the `-SNAPSHOT` suffix to get the milestone name (e.g., 
`4.22.0-SNAPSHOT` → `4.22.0`).
+
+2. **Assign the milestone**:
+   - Set the GitHub milestone on the PR: `gh pr edit <PR> --milestone 
<version>`.
+   - If the milestone does not exist yet on GitHub, create it first:
+     `gh api repos/{owner}/{repo}/milestones -f title="<version>"`.
+   - Set `fixVersions` on the corresponding JIRA issue to the same version. 
Note: `fixVersions`
+     cannot be set on an already-closed issue — always set it **before** 
closing.
+
+3. **Assign the PR and JIRA issue to the contributor**:
+   - Assign the PR to the PR author on GitHub: `gh pr edit <PR> --add-assignee 
<author>`.
+   - Ensure the JIRA issue is assigned to the contributor (it should already 
be from the
+     "JIRA Ticket Ownership" rules, but verify).
+
+4. **Categorize the PR with labels**:
+   - Determine the PR category from the linked JIRA issue type or PR content:
+     - `bug` — for bug fixes (JIRA type: Bug)
+     - `enhancement` — for improvements and new features (JIRA type: 
Improvement, New Feature)
+     - `documentation` — for documentation-only changes (JIRA type: 
Documentation)
+     - `task` — for chores, refactoring, build changes (JIRA type: Task)
+     - `dependency` — for dependency upgrades
+     - `test` — for test-only changes (JIRA type: Test)
+   - Apply the label: `gh pr edit <PR> --add-label <category>`.
+
+5. **Merge the PR**:
+   - Verify all merge requirements above are satisfied (human approval, no 
unresolved conversations).
+   - Merge the PR: `gh pr merge <PR> --squash` (or `--merge` / `--rebase` as 
appropriate).
+
+6. **Close the JIRA issue**:
+   - Transition the JIRA issue to **Resolved/Fixed** (ensure `fixVersions` is 
already set from step 2).
+   - Add a comment linking to the merged PR.
+
+7. **Clean up the branch**:
+   - Delete the PR branch after merge (GitHub may do this automatically if 
configured).
+   - As per the "Git branch" rules, branches must be cleaned up after merge or 
rejection.
+
 ### Code Quality
 
 - Every PR must include tests for new functionality or bug fixes.

Reply via email to