jerryshao opened a new pull request, #15061:
URL: https://github.com/apache/gravitino/pull/15061

   ### What changes were proposed in this pull request?
   
   For target branches that have Fork CI (currently `branch-2.0`), auto 
cherry-pick now opens its PR from a committer's fork instead of from a branch 
in apache/gravitino:
   
   - `auto-cherry-pick.yml` passes the login of the committer who merged the 
original PR (`merged-by`) to `cherry-pick-branch.yml`.
   - `cherry-pick-branch.yml` picks a token: the merger's 
`CHERRY_PICK_TOKEN_<LOGIN>` secret (login uppercased, `-` → `_`), falling back 
to `CHERRY_PICK_TOKEN_JERRYSHAO` (the fallback login can be changed with the 
`CHERRY_PICK_FALLBACK_LOGIN` variable).
   - Each token is checked before use: it belongs to that login, 
`<login>/gravitino` is a fork of apache/gravitino, and its `fork-ci.yml` is not 
disabled. Skipped tokens and the reason are listed in the job summary; the job 
fails if no token is usable.
   - The branch is pushed to `<login>/gravitino` and the PR is opened with head 
`<login>:<branch>`, so Fork CI runs on that fork's runners and the existing 
status publisher mirrors the result.
   - A re-run keeps an existing fork branch (it may hold conflict fixes) and 
accepts an already open PR; any other `gh pr create` failure now fails the job.
   - Target branches without Fork CI (`branch-1.3`) keep the previous behavior.
   
   ### Why are the changes needed?
   
   Auto cherry-pick branches were pushed to apache/gravitino with 
`GITHUB_TOKEN` (`CHERRY_PICK_TOKEN` is not configured), so Fork CI never 
started for those PRs, and any CI they did get ran on the scarce ASF runners. 
Using the merging committer's fork spreads the load across forks instead of 
making one fork's concurrency limit the bottleneck.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Committers who want cherry-pick PRs opened from their own fork need:
   
   1. A personal-account fork of apache/gravitino named `gravitino`, with 
workflows enabled in its Actions tab.
   2. A classic PAT with the `public_repo` and `workflow` scopes.
   3. A repository secret `CHERRY_PICK_TOKEN_<LOGIN>` in apache/gravitino 
holding that token.
   
   ### How was this patch tested?
   
   - YAML parses and every `run` script passes `bash -n`; the Fork CI script 
tests pass (`node --test .github/scripts/tests/*.test.cjs`).
   - Ran the head-resolution step locally for `branch-2.0` (fork mode), 
`branch-1.3` (upstream mode) and an invalid login.
   - Ran the token check against the GitHub API with a valid matching token, a 
token of another user, a missing token and an invalid token; checked the 
existing-PR lookup, the `fork-ci.yml` state lookup, `ls-remote` detection and 
the PR body for clean and conflict cherry-picks.
   - Not yet run end to end in Actions; the first `branch-2.0` cherry-pick 
after merge will exercise it.
   
   Known limitation (pre-existing): cherry-picks that change `.github/` cannot 
get a green Fork CI on a release branch, because trusted runs are only allowed 
for the default branch.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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