-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix github actions to only run on either pushes on main, or PRs to main #545
Conversation
@samuel-williams-da i'm not sure this is what we want. i need to be able to push branches and see the results of tests against those branches before i raise a pull request. this is a standard workflow for me. |
Can you not use a draft PR for this? Are you intending to have long running branches on this repo, vs a fork? |
@nycnewman What do you think, should allow CI to run on pushes to any branch? |
this change applies to all repos which include my fork. my workflow is generally, branch on my fork, push, test changes (the actions are run on my fork) then open a PR (then gets tested at review time on the primary repo). this change will stop those tests from running. |
i don't see a problem with the tests running twice (but, see below, i also don't see under what circumstances given the standard workflow this will happen). i also do not see the downside of allowing tests to run on branches. both of these things are normal practice. |
The issue with running twice is simply bloat and using more CI time. |
actually, under what circumstance do you expect to see duplicate runs? in the normal flow (e.g. what's happening right now in #543) you'll see the first CI runs on the primary repo when the PR is raised and not before (and you have to approve those workflows to run). if there are subsequent pushes to the branch the PR is based on then yes, CI will run again on those changes. in summary, i don't expect to see duplicate runs. |
I opened a test PR earlier today which created runs for both push and pull request on every commit in the branch |
See the last commit on this pr |
for the avoidance of doubt, no i don't intend to have long running branches on the primary repo and in fact, afaik i don't have write permission to create branches on the primary repo even if i wanted to. |
ah yes, when you have a branch on the primary repo then indeed you'll see it run tests against the branch then again on raising the PR and finally again when the PR lands. indeed, this is normal. |
Right okay, well I think it should be as simple as changing to |
The issue is that these commits were made after the PR was, so every new fix to the PR while its in progress gets CI run twice. |
in fact, not to belabor the point, it's what you want. when developing you want to see tests running against the branch. when you raise a PR, you want to see tests running against the target branch (master) after merging the dev branch. finally, when you land the PR, you want to see tests running against the now merged target branch. |
I'm not sure if github automatically rebases your branch before running CI for pull request jobs, so it may be that the pull_request and push jobs are running exactly the same thing in the case of pushing to an open PR. |
I will also say that on the |
i'm losing track of this discussion (sorry!) but if this is what the proposal is, then i support it. that config is standard in my experience:
|
a good point - it probably doesn't and i muddled up what happens at work in this respect 😆 |
ah yes i follow this bit now. using the azure workflow required i open a draft PR to get testing. i have found github actions superior in this respect in that i can run tests without having to open a PR and only when satisfied do that (in other workflows not involving this repository in fact it enables testing of branches and merges to master that skip raising PRs entirely - not advocating that to be a reasonable practice here! 😆 ) |
We can proceed with on push and on pull_request and just monitor the associated costs. My main concern is around access to secrets but i understand this to be restricted for fork branches |
It doesn't look like having |
if we land this it just means i need to open a draft PR for testing on my fork to get tests right? that's not a big deal. shall we do it @samuel-williams-da ? |
I'm going to leave this for now, as the issue appears to have gone away |
No description provided.