Commit Graph

172 Commits

Author SHA1 Message Date
Aliaksandr
49edff43c2 ci/github-script/merge: share reviews fetch with bot.js, drop events
`bot.js` already pulls reviews via GraphQL for the approval-count
labels. Move that fetch above the `handleMerge` call, add `commit
{ oid }` to the query, and pass the result through. `handleMerge` no
longer issues its own `listReviews` REST call.

While here, the `approvals` set is now derived from the same reviews
data. Two upsides:

- A reviewer who approved and was later dismissed no longer counts
  towards the approval check; their review now surfaces with state
  DISMISSED instead of leaving a stale `reviewed` event behind.
- `events` is no longer needed by `runChecklist` (it was only feeding
  the approvals filter); the parameter is dropped from both call
  sites. `handleMerge` still uses `events` for tracking the latest
  push and merge-command comments.

Also drop the redundant `user` truthy checks (and the stale "some
users have been deleted" comment) in `runChecklist`. The GraphQL
query uses `author { ... on User { login id } }` and bot.js then
filters via `r.user?.login`, so by the time reviews reach
`runChecklist` every entry already has a populated `user`. Verified
by querying real PRs: bots surface as `{__typename: "Bot"}` (no
`login`/`id`, filtered out by bot.js), and deleted accounts surface
as the "ghost" user (login `"ghost"`, id `10137`), which passes the
filter but matches no committer - harmless for both checks.

Assisted-by: claude-code with claude-opus-4-8[1m]-high
(cherry picked from commit 0c1c3d4813)
2026-06-25 17:10:22 +00:00
Aliaksandr
977e73ad9f ci/github-script/merge: clarify Auto Merge follow-up tip
The previous tip ("Sometimes GitHub gets stuck after enabling Auto
Merge") didn't explain why nothing happens immediately after the bot's
"Enabled Auto Merge" reply, leaving maintainers unsure whether to wait
or intervene. Spell out that Auto Merge waits for required CI before
queueing, that a later CI failure leaves the PR un-queued until it is
fixed, and link to GitHub's documentation; keep the existing "leave
another approval" workaround for the rare cases where Auto Merge stalls
after CI completes.

Assisted-by: claude-code with claude-opus-4-8[1m]-high
(cherry picked from commit 6f9325fb5d)
2026-06-25 17:10:21 +00:00
Aliaksandr
dee3291f65 ci/github-script/merge: refuse merge when a committer has requested changes
A "changes requested" review from a committer blocks both the merge
queue and auto-merge, but unlike approvals it isn't auto-dismissed
when new commits are pushed. Surface it as a checklist item so the
bot's reply explains the block instead of silently enabling
auto-merge that will never trigger.

Implementation pulls every review for the PR via `listReviews` and,
for each committer, takes the latest review whose state is
`APPROVED`/`CHANGES_REQUESTED`. The check fails if any committer's
latest stance is `CHANGES_REQUESTED`. Other review states fall out
naturally:

- A dismissed review surfaces as `DISMISSED`, so a committer
  dismissing their own changes-requested review unblocks the PR.
- A comment-only follow-up surfaces as `COMMENTED`, so it doesn't
  override an earlier actionable review - the prior stance still
  stands until the committer explicitly approves or requests changes
  again.

Assisted-by: claude-code with claude-opus-4-8[1m]-high
(cherry picked from commit b94b44d3f9)
2026-06-25 17:10:21 +00:00
Aliaksandr
9119d3e8f5 ci/github-script/merge: skip auto-merge when CI has already failed
The merge bot falls back to GitHub Auto Merge whenever the merge queue
won't accept a PR yet. That is the right move while CI is still
running, but pointless once CI has already failed: Auto Merge can never
trigger, and fixing CI requires a new push, which invalidates the merge
command anyway (the bot only acts on comments after the latest push).

Fetch the `no PR failures` commit status and, when the merge-queue
enqueue fails, branch on it. If CI has already failed
(`error`/`failure`), skip Auto Merge and reply that a fresh
`@NixOS/nixpkgs-merge-bot merge` comment is needed once CI is green
again. Otherwise (pending or missing status) enable Auto Merge as
before.

`merge()` now returns `{ reaction, messages }` so the CI-failure path
can leave a thumbs-down reaction rather than the rocket used for an
actual merge.

Closes #512554.

Assisted-by: claude-code with claude-opus-4-8[1m]-high
(cherry picked from commit da97bf8423)
2026-06-25 17:10:21 +00:00
Michael Daniels
186fef9d5e ci/github-script/merge: ignore case when checking for merge bot comment
(cherry picked from commit 41876c6de2)
2026-06-06 19:20:33 +00:00
zowoq
4b311a8f13 linux: add stable staging-nixos workflow
stable counterpart to d28cc2a2f5

(cherry picked from commit 10056dd40d)
2026-05-29 22:25:47 +00:00
Michael Daniels
9a5fe597b0 Revert "ci/github-script/reviewers: revoke stale review requests"
This reverts commit 2d34258228.

(cherry picked from commit 843634b667)
2026-05-18 21:35:08 +00:00
Michael Daniels
004d548768 Revert "ci/github-script/reviewers: keep team members when revoking stale requests"
This reverts commit b721b82180.

(cherry picked from commit acb7b7a38c)
2026-05-18 21:35:08 +00:00
Harinn
4456d8d3bd ci/github-script/reviewers: keep team members when revoking stale requests
Fixes:
https://redirect.github.com/NixOS/nixpkgs/pull/519758#issuecomment-4478985966
(cherry picked from commit b721b82180)
2026-05-18 17:57:23 +00:00
Harinn
f06eefe594 ci/github-script/reviewers: revoke stale review requests
New feature: revoke review requests from a reviewer when the reason they
were review-requested in the first place is gone (e.g. force-pushed),
while preserving reviewers who voluntarily engaged.

(cherry picked from commit 2d34258228)
2026-05-17 20:15:17 +00:00
Michael Daniels
52fa912f18 ci/github-script: update npm versions
(cherry picked from commit 8a89d7a286)
2026-05-17 18:51:28 +00:00
zowoq
92b8eb829c ci/github-script/check-target-branch: disable review for xanmod kernels
updates should go to master or release branches

(cherry picked from commit adabcdead3)
2026-05-17 18:31:19 +00:00
Michael Daniels
9fc73fddd7 [Backport release-25.11] ci/github-script: npm audit fix (#520657) 2026-05-15 23:38:25 +00:00
Michael Daniels
6a2b7142f0 ci/github-script: npm audit fix
Fixes Dependabot alerts.

(cherry picked from commit 95e34c848b)
2026-05-15 23:35:37 +00:00
Michael Daniels
104b87317b ci/github-script/prepare: fix review dismissals
I broke this in 1c3e149546 (diff-9baa1b84a40210e20622eeb04bea6db28ef3ff90dea79aa54ba9d1e27c150b21).

See #520239 for an example of this not working.

(cherry picked from commit c642405dbe)
2026-05-15 23:31:53 +00:00
Michael Daniels
5cb457b103 ci/github-script/manual-file-edits: skip on PRs from one dev branch to another
Same logic as in lint-commits.

Fixes https://matrix.to/#/!EoslJfrUGMtQOAfnht:lassul.us/$govFR3OHnME2TZh7tcDSJfXAEfnMVUevnv4l5y4qFD0?via=nixos.org&via=matrix.org&via=catgirl.cloud

(cherry picked from commit f5ee5762f0)
2026-05-09 13:02:11 +00:00
Michael Daniels
617b39bfe9 ci/github-script/lint-commits: confirm Git names/emails are present
Prevents issues reported on Matrix by Jujutsu users,
caused by people omitting these fields.

(cherry picked from commit 4d776b4670)
2026-05-06 13:34:15 +00:00
Michael Daniels
be22f9a507 Reapply {ci,workflows}: allow multiple blocking reviews"
A couple of bugfixes, but the problem was that the apps weren't installed.

(cherry picked from commit 1c3e149546)
2026-05-03 22:30:24 +00:00
Michael Daniels
797719cbd5 ci/github-script/merge: clarify maintainership is based on target branch
(cherry picked from commit bf5b890773)
2026-04-25 22:01:16 +00:00
Michael Daniels
dc02a812ce ci/github-script/manual-file-edits: init
Blocks manual edits to github-teams.json

(cherry picked from commit bd7e8b992b)
2026-04-17 01:37:26 +00:00
Kamil Monicz
3a18f893b9 ci/eval/compare: Expose attrdiff by kernel and platform
(cherry picked from commit 8926c73f50)
2026-04-13 15:05:58 +00:00
Michael Daniels
00812638b3 ci/github-script/merge: don't consider draft PRs eligible for merge bot
Fixes #499676

(cherry picked from commit 8c720affeb)
2026-03-14 21:19:54 +00:00
Michael Daniels
f468480986 ci/github-script/lint-commits: fix link to commit conventions
(cherry picked from commit 7d1f3b5df9)
2026-03-13 22:37:39 +00:00
Michael Daniels
6db2011fc9 ci/github-script/lint-commits: error when conventional commit format is used
E.g. https://redirect.github.com/NixOS/nixpkgs/pull/495442

(cherry picked from commit 58f002f950)
2026-03-12 22:13:44 +00:00
Michael Daniels
a6870d6871 ci/github-script: don't use GH API when getting commit info, return only subject
(cherry picked from commit d03b81d689)
2026-03-12 22:13:44 +00:00
Michael Daniels
de3d7652e0 ci/github-script: split getting commit details for PR into its own file
(cherry picked from commit 743ab29528)
2026-03-12 22:13:44 +00:00
Michael Daniels
ef2d0ea5df ci/github-script/merge: log when queuing/enabling merge
(cherry picked from commit a8fce8701c)
2026-03-11 04:05:18 +00:00
axodentally
bfe96e7c34 ci/github-script/merge: add more documentation links to bot's comment
(cherry picked from commit 86447ec024)
2026-03-09 14:40:55 +00:00
Emily
5bec687372 ci: get supported systems from the target branch
(cherry picked from commit fcb9bf6c05)
2026-03-01 21:23:12 +00:00
luojiyin
d338b02a71 fix: typo Enqueing -> Enqueuing in merge.js
(cherry picked from commit 7a91c688bc)
2026-03-01 13:35:10 +00:00
Michael Daniels
299bbe32b9 ci/github-script: add instructions for dependency updates
(cherry picked from commit 3a4282bc13)
2026-02-16 00:07:11 +00:00
Michael Daniels
b64488e43f ci/github-script: update dependencies, npm audit fix
`@actions/artifact` and `commander` now match the versions
used in `.github/workflows/bot.yml`.

(cherry picked from commit d70a72500c)
2026-02-16 00:07:11 +00:00
Michael Daniels
433440b6a6 ci/github-script/lint-commits: check for "fixup!" and friends
(cherry picked from commit 1921190502)
2026-02-14 18:59:57 +00:00
Michael Daniels
2d9351bc13 ci/github-script/lint-commits: support PRs with over 250 commits
We want to be able to check python-updates.

(cherry picked from commit c7eee1a755)
2026-02-14 18:59:57 +00:00
Michael Daniels
6801e9c840 ci/github-script/lint-commits: fix development branch check
https://redirect.github.com/NixOS/nixpkgs/pull/487628 should have had this
job fail, but [didn't](https://github.com/NixOS/nixpkgs/actions/runs/21753302803/job/62756645701?pr=487628#step:3:18),
because the head branch was named `master`.

(cherry picked from commit 0a07e4e187)
2026-02-08 02:22:12 +00:00
Silvan Mosberger
4d1ff1e51b ci: Fix team review requests from the bot
https://github.com/NixOS/nixpkgs/actions/runs/21782693200/job/62849125010
(cherry picked from commit 55faf59a25)
2026-02-07 16:43:26 +00:00
Silvan Mosberger
2de8472b15 ci/github-script/reviewers.js: Fix reviewer API request
It takes arrays, not sets, see https://github.com/NixOS/nixpkgs/actions/runs/21735690914/job/62700395870?pr=487491

(cherry picked from commit 71e704768d)
2026-02-07 11:09:38 -05:00
Silvan Mosberger
fa25c3a515 ci: First-class team package maintainer review requests
Co-Authored-By: Alexander Bantyev <alexander.bantyev@tweag.io>
(cherry picked from commit b0b2c24be9)
2026-02-07 11:09:38 -05:00
Michael Daniels
6315beae0c ci/github-script/check-target-branch: fix kernel exemption logic
Erroneously failed to exempt because I left out an if condition.

(cherry picked from commit e3f053a65d)
2026-02-07 00:20:40 +00:00
Michael Daniels
06ab464d08 ci/github-script/reviews: detect reviews belonging to commits.js
See comment, but TLDR this is for backwards-compatibility.

(See 479628, where it failed to dismiss after fixing.)

We don't bother with `prepare.js` because it always errors
(and so should never be dismissed).

I have simply added the needed comments to each of `check-target-branch.js`'s
pre-existing reviews, because there are so few.

(cherry picked from commit 7a74549a85)
2026-01-27 00:44:58 +00:00
Michael Daniels
c4a728596d ci/github-script/check-target-branch: do not "Request changes"
You can technically have multiple reviews requesting changes, but
there's no good way to dismiss all of the reviews requesting changes from
the same user using the UI.

This makes minimization impossible (because all but one of the reviews is not
dismissed, even though the PR is no longer blocked due to the review
in GitHub's system).

As a workaround, we will only comment.

CI will still fail when appropriate.

(cherry picked from commit c9225057c9)
2026-01-26 23:21:51 +00:00
Michael Daniels
8ef96bdbe0 ci/github-script/check-target-branch: kernel updates should not need to go to staging-xx.xx
(cherry picked from commit e1e5b8ad91)
2026-01-26 23:21:51 +00:00
Michael Daniels
1fb1e94ae1 ci/github-script/check-target-branch: loosen staging threshold for home-assistant
(cherry picked from commit cd6bc04a06)
2026-01-26 23:21:51 +00:00
Michael Daniels
2e33141358 ci/github-script/check-target-branch: simplify rebuildsAllTests variable
(cherry picked from commit 50590d21d5)
2026-01-26 23:21:51 +00:00
Michael Daniels
89ec5e11ce ci/github-script/check-target-branch: add type for changed-paths.json
(cherry picked from commit 99c1a35b73)
2026-01-26 23:21:51 +00:00
Michael Daniels
e6d05ec07a ci/github-script/{reviews,check-target-branch,commits,prepare}: add sticky review support
(cherry picked from commit 4447561c05)
2026-01-26 23:21:51 +00:00
Michael Daniels
b9712d47a3 ci/github-script/reviews: enable typescript
(cherry picked from commit 3fb23e6837)
2026-01-26 23:21:51 +00:00
Michael Daniels
d55bc207cc ci/github-script/bot: refine regexes
(cherry picked from commit 31876b4580)
2026-01-26 12:43:03 +00:00
Michael Daniels
685d3e87e9 ci/github-script/bot: only look at commit subject when deciding if a package is new/updated
(cherry picked from commit c717c98bc8)
2026-01-26 12:43:03 +00:00
Aliaksandr
a5020f4564 ci(bot): auto-label package updates with '8.has: package (update)'
Checks all PR commit messages for version update pattern
like 'packagename: X.Y.Z -> A.B.C'.

Matches: 1.2.3, 0-unstable-2024-01-15, 1.3rc1, alpha, unstable
(cherry picked from commit bf5645a0ed)
2026-01-25 20:41:45 +00:00