Commit graph

18 commits

Author SHA1 Message Date
Wolfgang Walther
ca5775952e
ci/check-cherry-picks: fix indent of truncation marker
This needs to be indented the same way as the remaining code-block,
otherwise the `</details>` is not rendered correctly.
2025-06-09 09:44:36 +02:00
Wolfgang Walther
856792f93e
workflows/check-cherry-picks: truncate long diffs after 10k characters
GitHub comments have a length limit, so we can't just dump everything.
The 10k limit is arbitrary, but the assumption is that reviewing the
range-diff is not the sensible thing to do once it becomes a certain
size - reviewing the regular diff and treating the commit as "new" is
easier to do in that case. Thus, truncating should work out fine,
especially when the full range-diff is still available in the runner
log.

This could still end up in with an error, if a PR has multiple commits,
which all hit the limit. Let's get there first, before we try to fix
that hypothetical case, too.
2025-06-01 09:35:51 +02:00
Wolfgang Walther
515b174c42
workflows/check-cherry-picks: post review comments
Instead of failing the job, the workflow will now post review comments
as "Request Changes". This makes the feedback more readily visible and
avoids having to merge despite a failing CI job. It is also a
pre-requisite to enable required status checks / required workflows in
the future.

Committers are asked to confirm the differences by explicitly dismissing
the generated review. After dismissal, the related review comment will
automatically be marked as "resolved".

The comments only report warnings and errors. Reviews are automatically
dismissed when they have been addressed by the author and no problems
remain. If problems remain, existing, still pending, review comments
will be updated. If the same problems had already been dismissed
earlier, no new review comment will be created either.
2025-06-01 09:35:47 +02:00
Wolfgang Walther
3dff9c34c0
ci/check-cherry-picks: improve formatting of failure reports 2025-06-01 09:35:46 +02:00
Wolfgang Walther
6054a8f217
ci/check-cherry-picks: refactor output / logging
This way it's a bit more centralized and easier to extend.
2025-06-01 09:35:45 +02:00
Wolfgang Walther
30600ac6d1
ci/check-cherry-picks: set -u 2025-06-01 09:35:44 +02:00
Wolfgang Walther
4c345b2fb4
ci/check-cherry-picks: remove unused condition
The command substitution style we recently switched to strips trailing
newlines, so we don't need to check for empty lines anymore.
2025-06-01 09:35:42 +02:00
Wolfgang Walther
802f353d05
ci/check-cherry-picks: add staging-next as pickable branch
Even though there is only a small window where a commit is not on
staging, but already on staging-next, it is technically valid to
backport commits from staging-next, too.
2025-05-30 13:04:31 +02:00
Wolfgang Walther
6847270de2
ci/check-cherry-picks: add staging as pickable branch again
This was accidentally removed in
ea636d1728, left-over from debugging.
2025-05-29 13:22:49 +02:00
Wolfgang Walther
dfaefc0535
ci/check-cherry-picks: fail without proper cherry-pick
When cherry-picking without -x or not cherry-picking at all, the
check-cherry-picks job would usually remain green. This is annoying to
deal with for reviewers, because "all green" still needs attention -
have all commits been cherry-picked properly?

If a commit was not cherry-picked correctly, either without -x or not at
all, because it's a genuine commit to begin with, the reviewers
attention is required anyway. Thus we can also let the job fail in this
case.
2025-05-28 15:31:32 +02:00
Wolfgang Walther
a9b718b796
ci/check-cherry-picks: never check older stable branches
This makes the job significantly faster when the commit can't be found
on master or staging directly. Before this change, the script would have
had to iterate through 20+ release branches before finding the latest
one. With lazy fetching for git enabled, this would take a few minutes.
2025-05-28 15:31:31 +02:00
Wolfgang Walther
ea636d1728
ci/check-cherry-picks: allow cherry-picking from haskell-updates and python-updates
Those are protected branches, which can't be force pushed to - so the
commits will remain. Thus, we can also backport from them.
2025-05-28 15:31:28 +02:00
Wolfgang Walther
e575364ae6
workflows/check-cherry-picks: reduce checkout time
Using a `tree:0` filter instead of `blob:none` reduces the checkout time
from over 3 minutes to about 45 seconds. The required trees/blobs will
then be fetched on-demand.

This on-demand fetching creates additional output for `git range-diff`
on stderr, so we hide that. This only happens the first time it's run,
so we don't need to adjust the other calls - which will still return any
real errors, should they happen.
2025-05-28 14:56:55 +02:00
Wolfgang Walther
245b1c1c48
ci/check-cherry-picks: never use a pager
In a small terminal window this would just stop running after each
commit until you exit the pager. That's not what we want when running it
locally.
2025-05-28 14:56:55 +02:00
Wolfgang Walther
2fea2bbf52
ci/check-cherry-picks: support different remotes than "origin"
The default is to checkout a contributors fork as "origin", thus the
NixOS/nixpkgs remote is most likely named differently. But not everybody
keeps their fork's main branches up-to-date all the time. Thus the
script would fail locally.
2025-05-28 13:26:42 +02:00
Wolfgang Walther
6cf5f9e83b
ci/check-cherry-picks: run shellcheck 2025-05-28 12:52:40 +02:00
Wolfgang Walther
e2a3792169
ci/check-cherry-picks: improve error handling
We recently moved the $commits variable out of a "subshell in a
herestring", let's do the same for the list of branches, where errors
would be silently swallowed as well.

Also reformat the expressions slightly, we have enough line-length.
2025-05-28 12:52:39 +02:00
Wolfgang Walther
ad4b36d2d2
ci/check-cherry-picks: move from maintainers/scripts
The script is part of CI and changes to it should be reviewed by the CI
owners. Thus moving it to ci/ is the most sensible thing to do.
2025-05-28 12:52:36 +02:00
Renamed from maintainers/scripts/check-cherry-picks.sh (Browse further)