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

gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 1f28fb6ea21b CAMEL-23932: Auto-delete stale branches and enforce fork 
usage for AI agents
1f28fb6ea21b is described below

commit 1f28fb6ea21b4aa8dd2a76a497fb93db94dca3e2
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Jul 31 23:02:15 2026 +0200

    CAMEL-23932: Auto-delete stale branches and enforce fork usage for AI agents
    
    Expand pr-cleanup-branches.yml to delete any non-protected branch pushed
    directly to apache/camel when its PR is merged or closed. Previously the
    workflow only covered automated/upgrade* branches.
    
    Protected patterns excluded: main, camel-*, regen_bot_*.
    
    Also strengthen AGENTS.md fork-preference from should to MUST.
    
    Co-authored-by: Claude Opus 4.6 <[email protected]>
---
 .github/workflows/pr-cleanup-branches.yml | 6 ++++--
 AGENTS.md                                 | 9 +++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/pr-cleanup-branches.yml 
b/.github/workflows/pr-cleanup-branches.yml
index 3871f49af0df..9686bc064e7f 100644
--- a/.github/workflows/pr-cleanup-branches.yml
+++ b/.github/workflows/pr-cleanup-branches.yml
@@ -26,11 +26,13 @@ permissions:
 
 jobs:
   cleanup:
-    name: Delete automated branch
+    name: Delete PR branch
     if: >-
       github.repository == 'apache/camel'
       && github.event.pull_request.head.repo.full_name == 
github.event.repository.full_name
-      && startsWith(github.event.pull_request.head.ref, 'automated/upgrade')
+      && github.event.pull_request.head.ref != 'main'
+      && !startsWith(github.event.pull_request.head.ref, 'camel-')
+      && !startsWith(github.event.pull_request.head.ref, 'regen_bot_')
     runs-on: ubuntu-latest
     steps:
       - name: Delete branch
diff --git a/AGENTS.md b/AGENTS.md
index 3c1844ec279c..501558871658 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -36,9 +36,14 @@ These rules apply to ALL AI agents working on this codebase.
 - An agent MUST NEVER push commits to a branch it did not create.
 - If a contributor's PR needs changes, the agent may suggest changes via 
review comments,
   but must not push to their branch without explicit permission.
-- An agent should prefer to use his own fork to push branches instead of the 
main apache/camel repository. It avoids to fill the main repository with a long 
list of uncleaned branches.
+- An agent MUST use its own fork to push branches instead of the main 
apache/camel repository.
+  Pushing directly to the upstream repo fills it with stale branches that 
waste CI time and disk
+  space for all contributors. A `pr-cleanup-branches.yml` workflow deletes 
non-protected branches
+  when their PR is closed, but using a fork avoids the problem entirely.
 - An agent must provide a useful name for the git branch. It should contain 
the global topic and issue number if possible.
-- After a Pull Request is merged or rejected, the branch should be deleted.
+- After a Pull Request is merged or rejected, the branch MUST be deleted. The
+  `pr-cleanup-branches.yml` workflow handles this automatically for branches 
pushed directly to
+  `apache/camel`, but agents using forks must delete their remote branch 
manually.
 
 ### JIRA Ticket Ownership
 

Reply via email to