zhengruifeng opened a new pull request, #60124:
URL: https://github.com/apache/spark/pull/60124

   ### What changes were proposed in this pull request?
   
   Replace the sampling job's full-history checkout and `git rev-list --count 
HEAD` with a GitHub GraphQL query for `Commit.history.totalCount` at the 
triggering `GITHUB_SHA`.
   
   The job uses the workflow token with the existing `contents: read` 
permission. It rejects missing or invalid counts before calculating the 
remainder. The one-in-ten sampling rule, job output, summary, and downstream 
build conditions are preserved.
   
   ### Why are the changes needed?
   
   The sampling job currently downloads Spark's entire Git history on every 
master push, including pushes whose build is sampled out. Getting the count 
through GraphQL avoids that checkout.
   
   This implements [Nicholas Chammas's suggestion on 
#60045](https://github.com/apache/spark/pull/60045#discussion_r4455095349). The 
query also works for `branch-4.x` when this optimization is backported.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   - `actionlint` and `git diff --check`.
   - Executed the actual workflow script against the live API for sampled and 
unsampled master commits and a `branch-4.x` commit; all counts matched `git 
rev-list --count` at the same SHA.
   - Executed the script with controlled counts 1 through 30; only 10, 20, and 
30 selected a build. API failures and empty, null, zero, negative, and 
non-integer counts failed without emitting a build-selection output.
   - Checked that the sampling job no longer requires checkout and preserves 
its repository condition, permissions, output, summary, and dependent job 
configuration.
   - Confirmed GitHub CLI is included in the `ubuntu-slim` runner image.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Codex (GPT-6)
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to