Commit graph

16 commits

Author SHA1 Message Date
Wolfgang Walther 86cbfd35a8 workflows/bot: rename from labels
This workflow / script is already doing more than must labeling: it's
already auto-closing package request issues.

Since we're going to migrate the nixpkgs-merge-bot into this workflow,
we'll rename things to a more generic name.

(cherry picked from commit d78de15627)
2025-11-01 15:02:00 +00:00
Wolfgang Walther 5a8ff6af2e workflows/pr: rename to pull-request-target
To be able to disable the pr.yml workflow on GitHub, we need to rename
it to a different name. Let's use the long name for consistency with
merge-group.yml. This only affects the GitHub-internal name, not the
visible name in the PR checklist, which is still "PR". This visible name
is also used by nixpkgs-review, so that won't break.

(cherry picked from commit f66a380ea3)
2025-11-01 12:09:54 +00:00
Wolfgang Walther 1e1fe53f87 ci/github-script/labels: fix unmaintained packages
The labeler currently breaks for unmaintained packages after the recent
change to use maintainer maps.

(cherry picked from commit 7b4a437e99)
2025-11-01 10:56:03 +00:00
Wolfgang Walther 249bef2536 ci/github-script/labels: set maintainer labels from latest maintainer map
Instead of setting the maintainer-related labels based entirely on Eval
results, this uses the new maintainer map from the target branch. This
allows labeling PRs correctly, that had been created *before* a
contributor became a maintainer of the respective package.

(cherry picked from commit 6b5e6cbbee)
2025-11-01 10:11:56 +00:00
Wolfgang Walther 7b9f3af613 ci/github-script/labels: prevent closing purposely-empty PRs
Some PRs are empty on purpose, for example the yearly notification about
the election for voters. We should not close these because the merge
commit is empty - only if there was a change intended, but the merge
commit *becomes* empty, we should act.

(cherry picked from commit a705a34a22)
2025-10-19 09:42:14 +00:00
Wolfgang Walther c26f06b994 ci/github-script/labels: close empty PRs
If the change of a PR has already been merged to the target branch
elsewhere, the PR will not be auto-closed by GitHub - and will still
show the same original diff. Still, the temporary merge commit is
actually empty. This causes all kinds of strange CI behavior, from not
showing rebuilds to not pinging maintainers.

We check the merge commit during labeling anyway, to see whether a merge
conflict is present. It's easy to just look a the number of affected
files in this merge commit - and if there are none, we can just
automatically close the PR as no longer relevant.

(cherry picked from commit 402b41c125)
2025-10-18 09:46:46 +00:00
Wolfgang Walther 087a36e5c0 workflows/labels: use Node 24
(cherry picked from commit b98ea083be)
2025-10-14 13:45:24 +00:00
Wolfgang Walther a4d4566c47 ci/github-script/labels: solve TODOs
These can now be removed after enough time has passed.

Advanced search is only the default from November 4, according to the
GitHub docs at:
https://docs.github.com/en/rest/search/search?apiVersion=2022-11-28#search-issues-and-pull-requests

(cherry picked from commit f0c1e4b672)
2025-10-14 13:45:24 +00:00
Ryan Omasta 6024fc6987 ci/github-script/labels: don't add stale if issue was mentioned
Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
(cherry picked from commit 4c6b9993e6)
2025-09-15 10:41:11 +00:00
Ryan Omasta ebe9db6538 ci/github-script/labels: keep "needs reviewer" if only automated reviews
(cherry picked from commit 32373aff1c)
2025-09-09 07:49:29 +00:00
Wolfgang Walther f814e824f8 ci/github-script/labels: auto close package request issues
This allows the labels workflow to support issue management in two ways:
- New package request can potentially created with a `4.workflow:
auto-close` label immediately and be closed automatically this way.
- Existing package requests can be bulk-closed by adding this label.
This has the advantage of posting the explanatory comment at the same
time, which is not possible with regular bulk operations.

(cherry picked from commit b5dee53399)
2025-08-29 19:31:18 +00:00
Wolfgang Walther 27c0126b67
ci: apply unsafe fixes with biome
(cherry picked from commit 23b82b3228)
2025-08-20 16:33:44 +02:00
Wolfgang Walther e6d63110df
ci: apply safe formatting with biome
(cherry picked from commit 1fa55d3900)
2025-08-20 16:33:41 +02:00
Wolfgang Walther 58846dd9b2 ci/github-script/labels: limit cutoff to max 1 day
It has only happened once, but the GitHub API suddenly returned a
workflow run from a few weeks back. This lead to quickly hitting the
rate limit for search requests.

Prevent this from happening by going back a day max for the "recently
updated" case. After roughly a day, every PR will have been touched by
the regular batch processing anyway.

Also save a few API requests, by taking bigger chunks of the search
result.

(cherry picked from commit 7f9f7a20b0)
2025-07-21 06:13:49 +00:00
Wolfgang Walther 383a849bd4 ci/github-script: extract common withRateLimit.js
This can and should be re-used across different scripts.

(cherry picked from commit 2192c5b6e8)
2025-07-15 12:57:57 +00:00
Wolfgang Walther 6f32a5f04e ci/github-script: default to commonjs
Since all github-scripts need to be written in commonjs, we now default
to it by not setting package.json. Support from editors for .js files is
slightly better than .cjs. To still allow using module imports in the
test runner script, we trick node into loading the script itself as a
module again via `--import ./run`.

(cherry picked from commit d11eba1e1d)
2025-07-15 12:57:57 +00:00
Renamed from ci/github-script/labels.cjs (Browse further)