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

   ### What changes were proposed in this pull request?
   
   Add a job-level `if:` guard on `.github/workflows/build_main.yml` so that 
the `Build` workflow does not run on pushes to `master` on a fork:
   
   ```yaml
   if: github.repository == 'apache/spark' || github.ref != 'refs/heads/master'
   ```
   
   ### Why are the changes needed?
   
   When a contributor clicks the "Sync fork" button on their fork's `master` 
(which mirrors `apache/spark`), GitHub records it as a push to `master` and 
fires `build_main.yml`, running the entire build/test matrix on the fork — 
duplicating work that already ran upstream. The pattern is already used in the 
per-branch workflows (`build_branch*.yml` gate with `if: github.repository == 
'apache/spark'`); this extends the same idea to `build_main.yml`, but only for 
the `master` branch on forks so that dev branches on forks continue to be 
tested.
   
   Behavior after this change:
   - Upstream (`apache/spark`) — runs for every branch, unchanged.
   - Fork, push to `master` (sync fork) — skipped.
   - Fork, push to any other branch (PR branches, rebases against upstream, 
merges from upstream into a feature branch) — runs, unchanged.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. CI behavior only.
   
   ### How was this patch tested?
   
   Inspected the condition manually against each scenario:
   - `github.repository == 'apache/spark'` — first clause is true → runs.
   - Fork, `github.ref == 'refs/heads/master'` — both clauses false → skipped.
   - Fork, `github.ref == 'refs/heads/<dev-branch>'` — second clause true → 
runs (covers rebases against upstream master and merges of upstream master into 
a dev branch, since those still push to the dev branch ref).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (claude-opus-4-7)


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