-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
workflows/auto-merge{,-enable,-abort}: init #261800
Conversation
To expand on the rationale: I've noticed that I very commonly have to tell people "this PR seems fine, I'll merge it once ofborg is green". Then I either forget, or I have to context switch at some later point in the future when I hope that ofborg will have completed :-) I'd much rather this be automated to save on that context switch and decrease merge latency. |
@@ -0,0 +1,27 @@ | |||
# This action aborts auto-merging by removing the label | |||
# when changes are pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried about TOCTOU problems here - it seems hard to "prove" for sure that they don't exist with how this is currently architectured. If you're confident that this implementation doesn't have TOCTOU problems, I'd thoroughly document it somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the github API, you can specify the sha hash to merge: https://docs.github.com/en/free-pro-team@latest/rest/pulls/pulls?apiVersion=2022-11-28#merge-a-pull-request
This means you can make sure that the PR was not updated with newer content than what your current state was.
.github/workflows/auto-merge.yml
Outdated
contents: write # for devmasx/merge-branch to merge branches | ||
pull-requests: write # for peter-evans/create-or-update-comment to create or update comment | ||
name: auto merge | ||
if: github.repository_owner == 'NixOS' && github.event.pull_request.merged == false && contains(github.event.pull_request.labels.*.name, 'auto-merge') && github.event.check_suite.conclusion == 'success' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that check_suite events contain the SHA of the commit for which they were ran. Maybe this is something we could use for merge-branch to additionally make sure that we're merging the right thing?
@@ -0,0 +1,37 @@ | |||
# This action ensures the "auto-merge" label can only by used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use this thread to bikeshed label name :P
My suggestion: "merge-on-green" or something along those lines, which attempts to state the condition for the merge to happen automatically.
Alternative implementations:
|
I've been testing this over here: https://github.com/felschr-org/nixpkgs/pull/6 |
Usually OfBorg will be the last check to finish, so it might be alright to ignore workflows. We can also include the workflows, but we need to specify all of them which is a bit error-prone. I'll still try using |
I think this might be a better fit for nixpkgs-merge-bot now. Either way, since I unfortunately don't have time to look into this further at the moment, I'm closing this PR. |
Description of changes
Add GitHub workflow for auto-merging PRs once checks all succeed based on a label that only committers can set.
This is very much WIP, not tested at all and I'm not that familiar with GitHub actions, but it seems feasible.
@delroth shared this idea on Matrix.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)