Commit Graph

232 Commits

Author SHA1 Message Date
Michael Daniels
03ebcfca96 ci/github-script/bot: don't count PR author as a default reviewer
See https://github.com/NixOS/nixpkgs/pull/567241#issuecomment-6387518337

(cherry picked from commit 687ba35b18)
2026-10-28 13:10:03 +00:00
Grayson Tinker
e7339f127c ci/github-script/prepare: qualify recommendation to retarget from nixos-*
(cherry picked from commit 4708e43402)
2026-10-26 09:45:22 +00:00
zowoq
aeef360d97 ci/github-script/check-target-branch-policy: add exemption for kernel config
Co-authored-by: Michael Daniels <mdaniels5757@gmail.com>
(cherry picked from commit c611bb7bac)
2026-10-22 17:32:59 +00:00
Michael Daniels
d278561f42 ci/github-script/reminders: don't remind on cherry-picks
Addresses https://github.com/NixOS/nixpkgs/pull/562912#issuecomment-6101844681

(cherry picked from commit 9e37f67efc)
2026-10-14 06:39:01 +00:00
Michael Daniels
f69c084839 ci/github-script/commits: extract cherry-pick logic to functions
(cherry picked from commit e051ed5d72)
2026-10-14 06:39:01 +00:00
Leonard Sheng Sheng Lee
70e81df281 ci/github-script/reminders: improve style guide reminder
(cherry picked from commit ec81376b20)
2026-10-11 20:35:13 +00:00
Jack Rosenberg
be2afecafe ci/github-script: consider whether PR is mergable in 'eligible' maintainers comment
Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
(cherry picked from commit a3edf85590)
2026-10-08 00:12:31 +00:00
Michael Daniels
9a16a2689c ci/github-script/{bot,merge,reviewers}: convert to TypeScript
Assisted-by: gpt-6.1-sol (Codex, light)
(cherry picked from commit 148a05c8b7)
2026-10-04 02:39:57 +00:00
Michael Daniels
3bc3bc350b ci/github-script: convert more to TypeScript
(cherry picked from commit 00954dbca6)
2026-10-02 21:09:06 +00:00
Martin Fischer
a1efd4705e nixpkgs-update: update links after move to NixOS org
(cherry picked from commit bf338732f2)
2026-10-02 14:20:28 +01:00
Peder Bergebakken Sundt
6f23b56ff8 ci/github-script/merge: indicate how to join nixos/nixpkgs-maintainers
Many simply never saw the invite email from github, and this error message is pretty unactionable.

It would also be a good idea to update the "About" description in https://github.com/orgs/NixOS/teams/nixpkgs-maintainers to indicate how to join.

(cherry picked from commit 470629541d)
2026-10-01 06:37:00 +00:00
Victor Engmark
fbc042c0ac ci/github-script/docs-styleguide: Use more common spelling of "style guide"
See
[trend](https://trends.google.com/explore?q=styleguide%2Cstyle%2520guide&date=all&geo=Worldwide)
for one indication that the new spelling is much more common.

Conflicts not backported:
  doc/README.md
  doc/styleguide.md

These files have diverged on master vs 26.05.

Not-cherry-picked-because: only backporting CI changes from 795f334f07
2026-09-28 14:20:20 +01:00
Michael Daniels
ea362d51a7 ci/github-script: convert various to TypeScript
(cherry picked from commit 32675f4b92)
2026-09-27 03:52:05 +00:00
Michael Daniels
aea1a1a7ae ci/github-script/bot: replace "unmaintained" label with "no default reviewers"
(cherry picked from commit 5a6dae1394)
2026-09-26 22:23:58 +00:00
Michael Daniels
a83314527f ci/github-script/commits: convert to TypeScript
Assisted-by: gpt-5.6-terra (Codex)
(cherry picked from commit 7f822c9dc8)
2026-09-26 00:26:34 +00:00
Ryan Hendrickson
0ecc130b0e ci/github-script/bot: label PRs for unmaintained packages
(cherry picked from commit db2eedfcba)
2026-09-23 14:08:52 +00:00
Johannes Kirschbauer
97cf7b465d ci: post a reminder for updated paths
docs are the first example

Assisted-by: Oh My Pi (Claude Opus 5)
(cherry picked from commit 40bb73107d)
2026-09-22 13:07:39 +00:00
Michael Daniels
963d91e296 ci/github-script/manual-file-edits: convert to TypeScript
(cherry picked from commit 4a7ddd0795)
2026-09-19 00:58:40 +00:00
Ihar Hrachyshka
0595c34a8b ci/github-script/bot.js: make llm-assisted label sticky
By popular demand, this patch lets folks manually label PRs with the
label and make it stick, even if auto-labeler wouldn't label it itself
(presumably because the author didn't mark their commits according to
automation policy).

Assisted-by: Codex gpt-5.6-sol medium
(cherry picked from commit 9686621d1b)
2026-09-06 15:57:10 +00:00
Michael Daniels
ace4b0e913 ci/github-script/bot: fix pagination
(cherry picked from commit 2e4bd2166b)
2026-09-05 00:07:37 +00:00
Michael Daniels
31d557fd6c ci/github-script/bot: log pagination cursor
This doesn't seem to change, even when it should.

I suspect this is related to the rate limit errors.

(cherry picked from commit 8cc85b1852)
2026-09-04 20:52:18 +00:00
zowoq
5803514388 ci/github-script/check-target-branch-policy: add exemption for kernels
kernel updates go to staging-nixos, they shouldn't be flagged

(cherry picked from commit 5a4d138f79)
2026-09-03 21:56:36 +00:00
Michael Daniels
bc027dc981 ci/github-script/commits.js: unbreak
This succeeded before the ESM conversion because we weren't in strict mode
(and therefore `line` was added to the global scope).

ES Modules run in strict mode by default, so this is a `ReferenceError` now.

TypeScript would have caught this! I will keep working on converting to it.

(cherry picked from commit 375b60d66b)
2026-09-02 00:43:08 +00:00
Matt Sturgeon
a55ad95d36 ci/commits: CJS __dirname → ESM
ESM modules no longer support CJS-style `__dirname` or `__filename`,
instead we should use `import.meta.dirname` and `import.meta.filename`
respectively.

https://nodejs.org/api/esm.html#no-__filename-or-__dirname
(cherry picked from commit 05e7795a4a)
2026-08-31 21:36:07 -04:00
Michael Daniels
60d4d34426 ci/github-script: convert to ES modules
ES modules work better with TypeScript than CommonJS modules do.

Assisted-by: GPT 5.6 Luna & Terra (Codex)
(cherry picked from commit eb501c45ae)
2026-09-01 00:24:43 +00:00
Michael Daniels
3f1bf1fa05 ci/supportedBranches.js: move to ci/github-script
This way it will be covered by our package.json when we configure ES Modules
in the next commit.

(cherry picked from commit 2d813b7719)
2026-09-01 00:24:42 +00:00
Ihar Hrachyshka
f916f3f006 ci/github-script/check-target-branch: evaluate exemptions in policy
Assisted-by: Codex gpt-5.6-sol medium
(cherry picked from commit 30a8636adf)
2026-08-28 08:10:45 +00:00
Ihar Hrachyshka
6370891755 ci/github-script/check-target-branch: check staging-nixos mass rebuilds
Assisted-by: Codex gpt-5.6-sol medium
(cherry picked from commit 221930c60c)
2026-08-28 08:10:44 +00:00
Ihar Hrachyshka
eb9040e631 ci/github-script/check-target-branch: simplify policy decisions
This commit hopefully improves readability: encapsulates some
intermediary decisions in variable, plus adopts early return decision
tree.

Assisted-by: Codex gpt-5.6-sol medium
(cherry picked from commit 403d5922cf)
2026-08-28 08:10:44 +00:00
Ihar Hrachyshka
bec0b0629c ci/github-script/check-target-branch: add policy tests
Tests reflect status quo. They establish baseline for later policy
changes. Some test cases are obvious bugs (e.g. mass rebuild checks are
skipped on staging-nixos), others may also be questionable.

Assisted-by: Codex gpt-5.6-sol medium
(cherry picked from commit e1aa8c4d16)
2026-08-28 08:10:43 +00:00
Ihar Hrachyshka
7c2242edbc ci/github-script: add npm scripts
Allows running `npm run typecheck` or `npm test`.

(cherry picked from commit 198d0cd473)
2026-08-28 08:10:43 +00:00
Ihar Hrachyshka
b2c2639af5 ci/github-script/check-target-branch: extract policy decision
This is in preparation to test the extracted pure function in the next
commit.

Assisted-by: Codex gpt-5.6-sol medium
(cherry picked from commit 3d17eabf1a)
2026-08-28 08:10:42 +00:00
Ihar Hrachyshka
8b54d470a8 ci/github-script/check-target-branch: extract review helpers
Assisted-by: Codex gpt-5.6-sol medium
(cherry picked from commit d003d54dc4)
2026-08-28 08:10:42 +00:00
Michael Daniels
31a761940e ci/github-script: add *.tsbuildinfo to gitignore
(cherry picked from commit 7b972175eb)
2026-08-18 22:34:21 +00:00
Michael Daniels
e23bb18fa9 ci/github-script/check-target-branch: convert to TypeScript
Only doing this one for now as a proof-of-concept.

(cherry picked from commit 2496d47b76)
2026-08-11 00:45:06 +00:00
Michael Daniels
8e8424fbf0 ci/github-script: check types by default
(cherry picked from commit 7045e3afe1)
2026-08-11 00:45:05 +00:00
Michael Daniels
e34052828c ci/github-script/run: correct variable name
(cherry picked from commit 578ac00958)
2026-08-11 00:45:04 +00:00
Michael Daniels
ca4cf44ba5 ci/github-script/.gitignore: add comparison artifact
Needed by check-target-branch.

(cherry picked from commit 78df5b944f)
2026-08-11 00:45:04 +00:00
Michael Daniels
0ba79fd321 ci/github-script: fix types for context
(cherry picked from commit f746c52b23)
2026-08-08 13:39:53 +00:00
Michael Daniels
8b8215c878 Revert "ci/github-script/get-pr-commit-details: output file list for merge commits"
(cherry picked from commit 03bf53cdb5)
2026-08-07 11:53:36 +00:00
Michael Daniels
ce0410faf3 ci/github-script/get-pr-commit-details: output file list for merge commits
Fixes a bug that was originally found by Claude and reported to the NixOS
security team by Anthropic as a security issue.

Previously, the file list was never output for merge commits.

This could have allowed someone who buried an edit to a file that shouldn't be
edited manually in a merge commit to not trigger the check.

It isn't a security issue, though, because the manual-file-edits check is not
a security boundary (just a friendly reminder to committers).

Anthropic report ID: ANT-2026-223Q3FSE

(cherry picked from commit e7804286db)
2026-08-02 05:04:45 +00:00
Michael Daniels
e6d3bf57d6 workflows: appease zizmor by installing npm pkgs from lockfile
(cherry picked from commit 4a45de05bd)
2026-07-24 21:46:01 -04:00
Michael Daniels
c066daa162 ci/github-script/lint-commits: add more conventional commit prefixes
Fixes #543681

(cherry picked from commit 1c28135859)
2026-07-22 13:28:12 +00:00
Ethan Carter Edwards
67b5fde37b ci/github-script/bot: label llm-assisted PRs accordingly
Discussed in AGENTS.md debate PR

Assisted by https://regex101.com/, my brain, and love for humanity and free software

Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
(cherry picked from commit 7eb5f48146)
2026-07-17 23:52:12 +00:00
Aliaksandr
926237f642 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:54 +00:00
Aliaksandr
e934e8a364 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:53 +00:00
Aliaksandr
86980620a2 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:53 +00:00
Aliaksandr
139a66fe7e 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:53 +00:00
Michael Daniels
ce0b8cc5dd ci/github-script/merge: ignore case when checking for merge bot comment
(cherry picked from commit 41876c6de2)
2026-06-06 19:21:06 +00:00
zowoq
fcf9006e23 linux: add stable staging-nixos workflow
stable counterpart to d28cc2a2f5

(cherry picked from commit 10056dd40d)
2026-05-29 22:26:23 +00:00