nixpkgs/ci/github-script
Aliaksandr 0c1c3d4813
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
2026-06-25 18:05:32 +03:00
..
.editorconfig ci/github-script: default to commonjs 2025-07-14 10:35:18 +02:00
.gitignore ci/github-script/commits: init from ci/check-cherry-picks 2025-07-16 11:50:13 +02:00
.npmrc ci/github-script: use real @actions/core 2025-07-15 15:09:02 +02:00
bot.js ci/github-script/merge: share reviews fetch with bot.js, drop events 2026-06-25 18:05:32 +03:00
check-target-branch.js linux: add stable staging-nixos workflow 2026-05-28 09:42:28 +10:00
commits.js ci/github-script/{reviews,check-target-branch,commits,prepare}: add sticky review support 2026-01-25 19:10:50 -05:00
get-pr-commit-details.js ci/github-script/lint-commits: confirm Git names/emails are present 2026-05-05 17:39:22 -04:00
get-teams.js ci/github-script/teams: use consistent style 2025-10-28 11:56:25 +01:00
lint-commits.js ci/github-script/lint-commits: confirm Git names/emails are present 2026-05-05 17:39:22 -04:00
manual-file-edits.js ci/github-script/manual-file-edits: skip on PRs from one dev branch to another 2026-05-08 13:37:28 -04:00
merge.js ci/github-script/merge: share reviews fetch with bot.js, drop events 2026-06-25 18:05:32 +03:00
package-lock.json ci/github-script: update npm versions 2026-05-17 14:41:57 -04:00
package.json ci/github-script: update npm versions 2026-05-17 14:41:57 -04:00
prepare.js ci/github-script/prepare: fix review dismissals 2026-05-14 22:00:55 -04:00
README.md ci/github-script/commits: init from ci/check-cherry-picks 2025-07-16 11:50:13 +02:00
reviewers.js Revert "ci/github-script/reviewers: revoke stale review requests" 2026-05-18 17:26:09 -04:00
reviews.js Reapply {ci,workflows}: allow multiple blocking reviews" 2026-05-03 18:17:03 -04:00
run ci/github-script/manual-file-edits: init 2026-04-12 19:57:37 -04:00
shell.nix ci/github-script: add gh dependency to dev shell 2025-07-15 12:19:41 +02:00
supportedSystems.js ci: get supported systems from the target branch 2026-03-01 16:07:49 -05:00
withRateLimit.js ci/github-script/bot: improve parallelism 2025-11-04 16:13:40 +01:00

GitHub specific CI scripts

This folder contains actions/github-script-based JavaScript code. It provides a nix-shell environment to run and test these actions locally.

To run any of the scripts locally:

  • Enter nix-shell in ./ci/github-script.
  • Ensure gh is authenticated.

Check commits

Run ./run commits OWNER REPO PR, where OWNER is your username or "NixOS", REPO is the name of your fork or "nixpkgs" and PR is the number of the pull request to check.

Labeler

Run ./run labels OWNER REPO, where OWNER is your username or "NixOS" and REPO the name of your fork or "nixpkgs".