Commit graph

16 commits

Author SHA1 Message Date
Wolfgang Walther 43f3fcc555
ci/github-script/merge: fix with deleted users
When a deleted user had approved a PR, this will cause the merge-bot to
fail.
2025-11-03 12:17:19 +01:00
Wolfgang Walther ffdc8205e5
workflows/bot: allow maintainer merges after committer approval
This allows committers to approve PRs with additional, optional nits
that the author-maintainer can either address or merge immediately
without these changes.

It also allows committers to approve a PR for merge, while still waiting
for other maintainers to give their feedback - they can then merge the
PR directly instead of passing it back to the committer.
2025-11-02 19:35:33 +01:00
Wolfgang Walther 9a637aa7a4
ci/github-script/merge: restructure head SHA check
While it was already the case that only merge comments *after* the
latest push were acted on, the logic wasn't easy to understand. This
change should make it more obvious, specially in combination with the
next commit, that all steps (comments, approvals, merge) must happen on
the same SHA - the current head SHA of the PR.
2025-11-02 19:35:32 +01:00
Wolfgang Walther 91c4d9236b
workflows/bot: allow maintainers to merge backports
All other conditions equal, there is no reason to prevent maintainers
from backporting changes to their packages. Maintainers are probably in
the *best* position to tell whether a certain change is backportable or
not - because they know the package well.
2025-11-02 17:26:01 +01:00
Wolfgang Walther 84d6678f3b
ci/github-script/merge: support OR conditions
This supports AND on the first and OR on the second level, which is
needed for some follow up work like backports, approval based merges or
trusted maintainers.
2025-11-02 16:36:14 +01:00
Wolfgang Walther 6848f93842
ci/github-script/merge: add TODO about second merge method
We have not observed this merge method being used in practice, yet. Not
in the new bot, not in the old bot. It seems like auto-merge works for
all cases.
2025-11-02 16:36:06 +01:00
Wolfgang Walther db8f50b4de
ci/github-script/merge: improve wording 2025-11-02 16:36:01 +01:00
Wolfgang Walther 2d0a8791fe
ci/github-script/merge: improve maintainer check 2025-11-02 16:35:56 +01:00
Wolfgang Walther 6a3c294f6f
ci/github-script/merge: move all conditions into runChecklist
No special casing anymore, all conditions are in the same place. This
also has the benefit of hiding the "has maintainers eligible for merge"
condition from comments, because it is only really relevant for
labeling.
2025-11-02 16:35:51 +01:00
Wolfgang Walther 7ea127c83a
ci/github-script/merge: move API requests out of runChecklist
This makes runChecklist mostly a pure function (except for logging) to
allow calling it repeatedly later.
2025-11-02 16:35:48 +01:00
Wolfgang Walther c7766c637f
ci/github-script/merge: improve caching of team members
This removes the need to `await` committers further down in the function
and allows re-using the cache for other teams later.
2025-11-02 16:35:16 +01:00
Wolfgang Walther 1aa72502fb
workflows/bot: fix permission in test workflow (#457575) 2025-11-01 17:57:59 +00:00
Wolfgang Walther 421974863f
workflows/bot: avoid access teams endpoints in Test workflow
We have no chance of getting a token that can request the team endpoints
in the pull_request context. This makes sense, because non-members of
the org are also not allowed to view the teams' memberships.

Thus, just fake an empty team - that's fine for the Test workflow.
2025-11-01 18:49:22 +01:00
Wolfgang Walther 00e7b934fb
workflows/bot: set "merge-bot eligible" label
This makes it more visible which PRs are merge-bot eligible, by setting
a label respectively.
2025-11-01 17:18:19 +01:00
Wolfgang Walther 89ace76ff1
workflows/bot: retry failed merges
By not keeping the node_id in the comments resulting from a failed
merge, these merges will be automatically retried.
2025-11-01 15:54:53 +01:00
Wolfgang Walther eea09eb9d3
workflows/bot: migrate nixpkgs-merge-bot to GHA
Running the nixpkgs-merge-bot in GitHub Actions instead of a separate
workflow has multiple advantages:
- A much better development workflow, with improved testability.
- The ability to label PRs with a "merge-bot eligible" label from the
same codebase.
- Using more data for merge strategy decisions, for example the number
of rebuilds.

This commits re-implements most of the features from the current
nxipkgs-merge-bot directly in the bot workflow. Instead of reacting to
webhook events, this now runs on the regular 10 minute schedule. Some
merges might be delayed a few minutes, but that should not be a problem
in practice.

To give the user early feedback, there are additional workflows running
when a comment or review is posted. These react with "eyes" to make the
user aware that the comment has been recognized.

The only feature not taken over was the size check for files in the PR.
This kind of check is not really relevant for maintainer merges only -
if we want to prevent bigger files from making it into the tree, then we
need a generic CI check, which is out of scope for the merge-bot.

Other than that, everything should be implemented - any omissions are by
accident.
2025-11-01 15:54:51 +01:00