Skip to content

First-class GitHub team reviews (reverted)#456481

Merged
philiptaron merged 1 commit intoNixOS:masterfrom
tweag:first-class-team-reviews
Feb 6, 2026
Merged

First-class GitHub team reviews (reverted)#456481
philiptaron merged 1 commit intoNixOS:masterfrom
tweag:first-class-team-reviews

Conversation

@infinisil
Copy link
Member

@infinisil infinisil commented Oct 28, 2025

This changes automation to request reviews from listed GitHub teams instead of their individual members when possible, allowing the team maintainers to make use of GitHub's advanced code review settings and making the team-review-requested:NixOS/someTeam PR filter more useful.

This applies for:

  • lib.teams that are listed as a package maintainer using the new meta.teams (thanks to check-meta: add a teams attribute #394797), with lib.teams.*.github being set to the matching GitHub team:
    meta = {
      teams = with lib.teams; [ someTeam ];
    };
  • GitHub teams that are listed as a code owner in ci/OWNERS:
    someFile @NixOS/someTeam
    

This pretty much implements #447514 after the preparatory work of #449986 and #450864.

Things done

  • Fully tested locally using various PRs that exercise all code paths

Add a 👍 reaction to pull requests you find important.

@MultisampledNight

This comment was marked as resolved.

@MultisampledNight MultisampledNight added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 6.topic: stdenv Standard environment 6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions labels Oct 28, 2025
@infinisil infinisil force-pushed the first-class-team-reviews branch from eba5e54 to 7e4ef3c Compare October 28, 2025 20:45
@nixpkgs-ci nixpkgs-ci bot added 6.topic: policy discussion Discuss policies to work in and around Nixpkgs backport release-25.05 labels Oct 28, 2025
Copy link
Contributor

@wolfgangwalther wolfgangwalther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just skimmed the code quickly, the two biggest issues we need to sort out:

  • This introduces a lot of new bash code, which is against our policy on new CI code.
  • We will need to see how to deal with #450864, which currently changes the social contract of Nixpkgs massively, imho.

Also found a specific change that would currently break the labeler.

Blocking this PR, so that it's not accidentally merged.

@github-project-automation github-project-automation bot moved this to In Progress in Stdenv Oct 29, 2025
@infinisil
Copy link
Member Author

I guess you mean #450864 (comment) (I suggest opening a new issue), but this PR just depends on the fact that GitHub teams have the same members as the linked lib.teams, so it won't be affected even if the process or syncing is flipped around in the future.

  • This introduces a lot of new bash code, which is against our policy on new CI code.

I already complained in #456341 (comment), but I concur that it makes sense for the policy as worded to apply here. I'm not very happy about it because most of the code was already written before the policy existed, and I assumed it wouldn't apply because no new scripts are created and all the review requesting code is written in bash right now.

How about this as a compromise: I'll try to rewrite the request-reviewers.sh script (which contains the most changes) in JS, but everything else will be left as bash for this PR.

@infinisil
Copy link
Member Author

@wolfgangwalther I now committed a working JS version of the script as mentioned above, but can you help me integrate it? In particular I'd just like to have a buildable derivation for ci/github-script that produces a runnable result/bin/github-script executable for the run script. This will make it very easy to swap out calls to request-reviewers.sh.

@wolfgangwalther
Copy link
Contributor

wolfgangwalther commented Nov 1, 2025

I now committed a working JS version of the script as mentioned above, but can you help me integrate it? In particular I'd just like to have a buildable derivation for ci/github-script that produces a runnable result/bin/github-script executable for the run script. This will make it very easy to swap out calls to request-reviewers.sh.

I believe that a "runnable github-script" thing is fundamentally the wrong thing. We'll want to run this with actions/github-script - the local wrapper is just something for development, but we don't even try to replicate the upstream environment 100%.

I didn't look at the script you wrote in full detail, yet, but two notes:

  • I'm pretty sure that ci/request-reviews: untangle owner-related bash code #457503 should help a lot with the integration problems you're facing. I'll likely add 1-2 more commits.
  • My idea for migrating the reviewers stuff to JavaScript is to integrate it into labels.js (soon to be renamed to bot.js or something). This will give us a few benefits for requesting reviews in general, such as being able to expire review requests, rotating through them over time, requesting reviews for already existing PRs after becoming owner/maintainer and so on. I have yet to think about how this interacts with this PR here, aka in which order to do things to make it easier overall. Please give me a few days to do so.

@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 1, 2025
@nixpkgs-ci nixpkgs-ci bot requested a review from Mic92 January 22, 2026 15:40
@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 22, 2026
@infinisil infinisil force-pushed the first-class-team-reviews branch from 780112a to d53c754 Compare January 25, 2026 11:26
@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 25, 2026
@infinisil infinisil force-pushed the first-class-team-reviews branch from d53c754 to e9c544a Compare January 25, 2026 13:44
@infinisil
Copy link
Member Author

@MattSturgeon Thanks for the review and pointers! I knew how code could be run locally, though was originally set on testing it in a real repo (like I've done before on CI changes). However it turns out this isn't easily possible anymore due to the merge queue and maintainer maps.

Anyways, I now just tested the code locally to cover as many paths as possible. In particular I used #471082 to test the "PR reviews on behalf of a team" thing. I fixed some minor problems while doing so, and refactored the code a bit for clarity.

I'm 95% confident this is going to work in practice now and am ready to do follow-ups if it doesn't. @MattSturgeon want to take another look or give an approve/merge? :D

@philiptaron
Copy link
Contributor

philiptaron commented Jan 31, 2026

Matt (or any other member of CI team) is free to merge without this, but I plan to review/test and merge today or tomorrow, personal and family bandwidth permitting.

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! The approach looks good, but I found a few bugs while reviewing.

I ran TypeScript with --checkJs on the JS files and it caught these issues. I will be looking into setting up automatic type checking for ci/github-script/ since it catches problems like this quickly.

@infinisil infinisil force-pushed the first-class-team-reviews branch from e9c544a to d40dd99 Compare February 3, 2026 13:24
@infinisil
Copy link
Member Author

@philiptaron Thank you very much, fixed now!

@infinisil infinisil requested a review from philiptaron February 3, 2026 13:24
.request({
method: 'GET',
url: '/organizations/{orgId}/team/{id}',
orgId: github.repository_owner_id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find this anywhere. Is this context.payload.repository.owner.id?

Copy link
Member Author

@infinisil infinisil Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh nice catch, yeah I took this from https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#github-context, but right, that github variable is different from this one.

While context.payload.repository.owner.id doesn't exist, context.payload.pull_request.base.user.id does, now using that! Tested locally

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for the github.repository_owner_id thing. I didn't test this locally yet, but I can't find anything in Octokit that would set this.

@infinisil infinisil force-pushed the first-class-team-reviews branch from d40dd99 to a26b6e7 Compare February 5, 2026 13:50
@infinisil infinisil force-pushed the first-class-team-reviews branch from a26b6e7 to 193deb8 Compare February 5, 2026 13:52
@philiptaron philiptaron added this pull request to the merge queue Feb 6, 2026
Merged via the queue into NixOS:master with commit ba626b8 Feb 6, 2026
48 of 51 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Stdenv Feb 6, 2026
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Feb 6, 2026

Successfully created backport PR for release-25.11:

@github-actions github-actions bot added the 8.has: port to stable This PR already has a backport to the stable release. label Feb 6, 2026
@mdaniels5757
Copy link
Member

We had to revert in #487507, unfortunately. Please see there for details.

@infinisil
Copy link
Member Author

Unfortunate, reopened with the fix as #487955

@infinisil infinisil changed the title First-class GitHub team reviews First-class GitHub team reviews (reverted) Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions 6.topic: policy discussion Discuss policies to work in and around Nixpkgs 6.topic: stdenv Standard environment 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. backport release-25.11 Backport PR automatically

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

First-class GitHub team support for review requests

7 participants