-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[9.x] Prevent workflows from running twice #44053
[9.x] Prevent workflows from running twice #44053
Conversation
I think that's actually desirable that they run twice, allowing testing before cutting a PR. |
I am sorry, but could you please explain what you mean with "cutting a PR"? 😅 |
Opening a pull request. |
It would be better to only listen on
|
Bit torn. I've thought about this a lot in the past already and my gut feeling says it'll be annoying to not be able to build on individual branches anymore before sending in a PR.
That would mean directly pushed code to existing stable branches isn't tested anymore? |
@Jubeki @GrahamCampbell @taylorotwell maybe we should just give this a try to see how it goes and then evaluate if we want to keep or ditch it. |
I am also a bit torn about it, but most features are worked on in a Draft PR, so that would mean the tests would still run.
I also think that would be the case, but I am not completely sure. |
Thanks @Jubeki |
Explanation
When creating a PR from a branch within the same repo (i.e. not a fork), the current run-test workflows get triggered twice - for both push and pull_request:
This PR adds constrains so that the workflow only runs once.
(Push Event will only be triggered on the
master
and*.x
branch)Sources
Idea and Changes are taken from spatie/package-skeleton-laravel#119
Thanks and Credits to @jessarcher
Branch names can use patterns for Pull Requests:
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
Side note
I think it would be good to change the default branch to main per
https://github.com/github/renaming#new-repositories-use-main-as-the-default-branch-name