Skip to content

[CI] Don't trigger GHA pull_request on PRs from local branches#10636

Closed
straight-shoota wants to merge 1 commit intomasterfrom
feature/ci-restrict-pr-gha-local-branches
Closed

[CI] Don't trigger GHA pull_request on PRs from local branches#10636
straight-shoota wants to merge 1 commit intomasterfrom
feature/ci-restrict-pr-gha-local-branches

Conversation

@straight-shoota
Copy link
Copy Markdown
Member

@straight-shoota straight-shoota commented Apr 14, 2021

@straight-shoota
Copy link
Copy Markdown
Member Author

This seems to be working as intended (despite #9890 (comment)). Only jobs triggerd from the push are running.

@Sija
Copy link
Copy Markdown
Contributor

Sija commented Apr 15, 2021

@straight-shoota That solution wasn't working for me.

@straight-shoota
Copy link
Copy Markdown
Member Author

Yeah, maybe there was some confusion because the configuration changed after the PR was created. Or some other glitch. I mean this configuration shouldn't really disable all jobs.
That's why I figured to try again.

@Blacksmoke16
Copy link
Copy Markdown
Member

Blacksmoke16 commented Jul 3, 2025

Can you not just do:

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

Such that it runs on PRs opened to master AND on pushes to master but not both? This is what I use in the Athena repo and it seems to work fine.

EDIT: Re-reading the other issue/PR, I'm with Sija on this one. Open a draft PR if you want to run CI/touch up any failures before having it be ready or review. Otherwise we're just wasting CI minutes (even tho they're free 🤷).

@straight-shoota
Copy link
Copy Markdown
Member Author

@Blacksmoke16 I don't think that'll do. At least not that restrictive.

We need PR workflows to trigger for more target branches. Release and master of course, but also occasionally we have stacked PRs where any feature branch can serve as a target for a pull request.

And I'm pretty sure we want CI to trigger on any pull request to make sure the code is good when merged. This PR is actually not good in that regard either.

I think we should close this.
There is not that much to gain. Especially since we significantly reduced the number of CI workflows on a normal PR (#14983), there's not as much overhead as before.

@straight-shoota straight-shoota deleted the feature/ci-restrict-pr-gha-local-branches branch July 3, 2025 13:30
@Blacksmoke16
Copy link
Copy Markdown
Member

Okay, then wouldn't it be enough to just remove the branch requirements on pull_request event but keep push unchanged, and maybe even add a release/* to handle that. Seems like an easy win to reduce amount of CI jobs.

@straight-shoota
Copy link
Copy Markdown
Member Author

I just don't think it's worth it.

We don't push that many branches directly to this repo. And those who are, we typically want to run CI on them, often that's the explicit reason to push them.

So unless I'm missing something, I don't see many instances where a branch is pushed directly to this repo, and we could avoid running some extra CI on push events.

@Blacksmoke16
Copy link
Copy Markdown
Member

Ohh you know what, my confusion came from the fact that for #15954 I opened it via GH UI which made it do both event CI jobs whereas normally I open them from my fork which only does pull_request. So I was thinking every PR opened gets duplicated like that, which just isn't entirely true. So disregard, current state is fine 👍.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants