Croway opened a new pull request, #25959:
URL: https://github.com/apache/camel/pull/25959

   # Motivation
   
   A lot of PRs fail on the `Fail if there are uncommitted changes` step of the 
**Build and test** workflow (generated files not regenerated/committed — e.g. 
#25939). At that point CI has already done the expensive work: `regen.sh` 
succeeded and the regenerated files are sitting in the runner's workspace — we 
currently just print the diff into the log and throw it away. Fixing such a PR 
today means checking it out and running a ~15 minute regen build locally.
   
   # Changes
   
   **`pr-build-main.yml`** — when the uncommitted-changes check fails, the 
regenerated changes are saved with `git diff --cached --binary` and uploaded as 
a `regen-patch` artifact together with the PR number (the `ci-comment` artifact 
is not produced on this failure path, so the patch artifact must carry the PR 
number itself — same approach camel-quarkus uses for its dependabot branch 
synchronization).
   
   **`pr-test-commenter.yml`** — the existing commenter workflow (which already 
runs in the base-repo context with `pull-requests: write`) now also looks for a 
`regen-patch` artifact on the completed run and posts/updates a single 
marker-based comment on the PR with ready-to-use apply instructions:
   
   ```bash
   gh pr checkout <PR> --repo apache/camel
   gh run download <RUN_ID> --repo apache/camel -n regen-patch
   git apply --index regen.patch && rm regen.patch pr-number
   git commit -m "Regen" && git push
   ```
   
   `git apply --index` stages everything including newly added/deleted 
generated files (a plain `git commit -am` would miss untracked new files). When 
a later run is clean, the comment is updated to a resolved state instead of 
leaving a stale warning.
   
   # Who can use it
   
   Anyone with push access to the PR branch: the PR author, or any 
committer/PMC member when *Allow edits from maintainers* is enabled on the fork 
PR (it is by default for user-owned forks). This makes fixing a contributor's 
failing PR a ~30 second operation.
   
   # Security considerations
   
   No new tokens, secrets, or permissions are introduced. The patch is uploaded 
by the unprivileged build job as plain data; nothing applies it automatically — 
a human applies and pushes it with their own credentials, and the resulting 
commit goes through normal review. A possible follow-up (separate discussion) 
would be a `/regen` comment command that applies the patch from CI 
automatically, following the camel-quarkus `synchronize-dependabot-branch.yaml` 
pattern, but that requires a bot account PAT to push to forks — hence doing 
this cheap step first.
   
   ---
   _Claude Code on behalf of Croway_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to