Commit graph

13 commits

Author SHA1 Message Date
Wolfgang Walther f7d6d11e8e
workflows/check: don't check github api for owners file
This removes the "owners" check from codeowners-validator. With it, all
tokens and permissions can be removed, because these were only needed to
make these requests.

This solves the problem of codeowners-validator not supporting our new
nested team structure for nixpkgs-maintainers. To make the onboarding of
new teams easier, we moved all teams "under" the nixpkgs-maintainers
team. This makes them inherit the right privileges (triage) for Nixpkgs.

However, this inheritance is not recognized by codeowners-validator,
thus it assumes that these teams don't have access to Nixpkgs. This then
fails the owners check immediately.

Removing the owners check also has a few other advantages:
- This check depends on external state: If a user is renamed or a team
removed, the check will fail. This makes it a bad check for required
status checks or merge queues - the check might fail randomly,
independent of the current PR.
- Running this check in a fork will never work, because the respective
users and teams don't have access to the fork's repo.

Both of this required us to set `continue-on-error: true` most of the
time.
2025-09-28 18:22:01 +02:00
Wolfgang Walther 40d8532c08
ci/github-script/prepare: identify real base branch (#435596) 2025-08-25 12:05:12 +00:00
Wolfgang Walther 956d0a744d
workflows/check: allow owners to fail when ci/OWNERS is untouched
The owners check is not reproducible, because it depends on the state of
the NixOS org on GitHub. Owners can rename their accounts or they can
leave the organisation and access to Nixpkgs can be removed from teams.
All of this breaks the owners check for reasons unrelated to the PR at
hand.

This PR makes the check for the owners file conditionally required: Only
when the ci/OWNERS file is actually modified a failed check will block
merging the PR. When that's not the case, the check will still fail
visibily in the checklist, but the failure can be ignored.

This is especially relevant for the Merge Queue, which should not be
entirely blocked whenever any of these events happen.

Also, it allows passing the checks in a fork when testing, where the
owners check will *always* fail, because the respective teams and
members are never part of the "user org" that a fork is.
2025-08-24 20:11:29 +02:00
Wolfgang Walther 87d9b08ffb
ci/github-script/prepare: identify real base branch
When a contributor mistakenly sets the wrong target branch for a Pull
Request, this can lead to bad consequences for CI. Most prominent is the
mass ping of codeowners, that is already handled in
`ci/request-reviews/verify-base-branch.sh`. But there are other things
that go wrong:
- After eval, a mass ping of maintainers would still be possible, in
theory. Practically, this doesn't happen, because we have a limit of 10
reviewer requests at the same time.
- This will most often contain a change to `ci/pinned.json`, thus the
full Eval matrix of all Lix/Nix versions will be run, burning a lot of
resources.
- The PR will be labelled with almost all labels that are available.

We can improve on the current situation with some API calls to determine
the "best" merge-base for the current PR. We then consider this as the
"real base". If the current target is not the real base, we fail the
prepare step, which is early enough to prevent all other CI from
running.
2025-08-24 18:09:08 +02:00
Wolfgang Walther 0601cf6fd0
ci/github-script/prepare: avoid running CI when targeting channel branches
This moves the no-channel-base check into the prepare script to exit
early and prevent all of CI to run against those branches. We also
provide better output by posting a "Changes Requested" review, using the
existing infrastructure from the old cherry-picks check.

The review will be dismissed automatically once the branch has been
corrected, because the commits check will run and do it.
2025-08-24 17:58:51 +02:00
Wolfgang Walther f94fd64d53
ci/github-script/prepare: fix logging of branch classification
Logging objects to stdout is not possible with `core.info`, so we
fallback to `console.log` instead. There's no functional difference for
these anyway.
2025-08-20 17:59:27 +02:00
Wolfgang Walther 46a1b0a7bc
ci/github-script/prepare: determine changed files 2025-08-20 17:18:36 +02:00
Wolfgang Walther 4220a03df8
ci/github-script/prepare: classify branches 2025-08-20 17:18:25 +02:00
Wolfgang Walther 9caf455441
ci/github-script/prepare: load systems 2025-08-20 17:17:12 +02:00
Wolfgang Walther 1fa55d3900
ci: apply safe formatting with biome 2025-08-20 15:41:24 +02:00
Wolfgang Walther a8cb53611b
ci/github-script/prepare: refactor
Using core.info instead of console.log and simplifying the arguments for
API calls a bit.
2025-08-20 15:16:20 +02:00
Wolfgang Walther f5d3e43368
ci/github-script/prepare: run biome
This will be added to treefmt in a different commit / PR.
2025-08-20 15:16:20 +02:00
Wolfgang Walther c787c66de6
ci/github-script/prepare: init from actions/get-merge-commit
This just moves the code over to ci/github-script to make it easy to
test and iterate on locally.

The name `prepare` is chosen, because the script will be extended with
the other steps from "PR / prepare" next.
2025-08-20 15:16:15 +02:00