-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub Actions has overlapping triggers which causes tests to run twice when pushing to an open PR #1370
Comments
I think you can also use the pull request
|
@NathanielRN yup that could work as well! My only concern is that if we restrict the what do you think? |
@AzfaarQureshi I personally find it really helpful to see tests on my commits, then when I make the PR I can be sure that it is passing tests and can be merged. Not to mention that people have the ability to make pushes to their branches after its been approved. Please let me me if I misunderstood, but if you restrict it to only pushes to |
@NathanielRN oh, the tests will still run whenever you push new commits to an open PR. For example https://github.com/open-o11y/opentelemetry-python/pull/7/commits you can see that beside every commit there is a link to a unique execution of the test workflow (you can confirm this by looking at the runner ID and see they're diff). Restricting push to master only means that the push itself won't trigger a new workflow but commits to a branch with an open PR will still result in CI re-triggering |
Right that's because by default the pull request includes the type Like I said a push on every commit seems useful to me, especially since it allows developers to see if their code passes tests on remote (without having to open a PR to check this!) which is the end goal. I've found in the past that passing only locally can be misleading. |
Not sure what you mean by this exactly because the tests will still be run upstream when you open the PR
right, as you mentioned, the It seems like @codeboten also had a chore listed to restrict the push to run on master only 9f5de45. Was there prior community discussion/consensus on this matter? Either way, @NathanielRN's suggested change on:
pull_request:
types: [opened, reopened] also achieves the same result of removing redundant workflows so that change is fine by me too 😄 |
This issue was marked stale due to lack of activity. It will be closed in 30 days. |
Closing, we only run CI on pull requests now (except pushes to main). |
This is seems to be a common[1] issue[2] and there really is not a very satisfactory solution other than adding an "if" on the job rather than on the top-level workflow. Of course, there were other solutions listed, but they'd involve managing a hardcoded list of branch names where the "on push" action is triggered. So I went for the workaround listed in [1], which adds an if to the job specification. [1]: zopefoundation/meta#145 [2]: open-telemetry/opentelemetry-python#1370 Signed-off-by: aszlig <aszlig@nix.build>
What is the issue
There are overlapping triggers for the
test
workflow which causes it to run twice if you commit to an open PRWhy is this a problem
Well, it's not that deep of a problem but:
it's more of a mild inconvenience but the fix is super quick (I can make a PR if the change is green-lit 😄)
We can solve this by only allowing pushes on master to trigger the workflow
Steps to reproduce
test
workflow only runs once under thepull_request
trigger (expected behavior)test
workflow runs twice, once underpull_request
(expected) and again underpush
(unexpected)The text was updated successfully, but these errors were encountered: