Commit graph

18 commits

Author SHA1 Message Date
Wolfgang Walther 64fbd08045 ci/github-script/commits: split review function into separate file
This allows re-using postReview in the next commit.

(cherry picked from commit c96b0e6d3d)
2025-08-25 12:05:51 +00:00
Wolfgang Walther 59eb6387fa workflows/check: always run commits job
This is the very first step to extending the commits job to do more than
just cherry-picks in the future: It could check reverts or merge
commits, but also the commit message format and more.

Of course, cherry-picks are still just checked on the stable branches as
before. For now, this allows us to run the part that dismisses automated
reviews automatically. This helps us when we do branch related checks in
the prepare step, which would also create such a review. To avoid
cluttering multiple reviews across a PR, we'll want all of these reviews
to be handled by the same code, thus this change.

(cherry picked from commit b6bbf7b250)
2025-08-25 12:05:51 +00:00
Wolfgang Walther 9bea5d3844 workflows/test: init
This workflow runs the PR and Push workflow files on a `pull_request`
trigger. The intent is to test changes to the workflow files
immediately. Previously, these were run directly from the respective
workflow files.

The new approach allows us to move the logic to run this only when
workflow files changed from the pull_request trigger into a job. This
has the advantage that older jobs are cleaned up, when the PR changes
from a state of "workflow files changed" to "no workflow files changed".
This can happen when changing a PR's base from staging to master, in
which case changes from master would temporarily appear in the PR as
changes. When these include changes to workflow files, this would
trigger the PR workflow via `pull_request`. Once the base is changed,
the PR is closed and re-opened, so CI runs again - but since it's on the
same commit and the new run doesn't trigger `pull_request`, the results
of the previous run are still kept and displayed. These results may
include cancelled or failed jobs, which are impossible to recover from
without another force-push.

Checking this condition at run-time is only possible, because we move it
into a separate workflow, turning the `pr.yml` workflow into a re-usable
workflow. This will make sure to skip the whole workflow at once, when
no change was detected, which will prevent the "no PR failures" job from
appearing as skipped - which would imply "success" and make the PR
mergeable immediately. Instead the "no PR failures" job is not shown at
all for this trigger, which is generally what we want.

Do the same for `push.yml` for consistency.

(cherry picked from commit 443f30f811)
2025-08-24 10:15:02 +00:00
Wolfgang Walther b0e0a560da ci/github-script/commits: fix logging no-cherry-pick message
This has severity "important", which is not a `core` function. Falling
back to `core.info` for all unknown values now.

(cherry picked from commit 2257beb1d0)
2025-08-22 07:33:47 +00:00
Wolfgang Walther cafd0bbe8a ci/github-script/commits: fix not-cherry-picked-because regex
This needs the multiline flags, which enables `^` and `$` to match line
start and line end, not start and end of the whole string.

Not sure how this got past testing when initially merged.

(cherry picked from commit 8ec348d644)
2025-08-22 07:33:47 +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 654a1c86cd ci/github-script/commits: conditionally show comments
This only shows *some* of the additional hints, depending on what the
checks resulted in. Should hopefully reduce confusion a bit.

(cherry picked from commit 91fd9b10ac)
2025-08-14 16:38:09 +00:00
Wolfgang Walther f0dedca934 ci/github-script/commits: allow reason for not cherry-picking
This change allows giving a reason via footer of the commit message for
why this commit is not cherry-picked. This avoids having to "explain"
the automated review comment afterwards - instead, this explanation can
be given immediately when writing that commit.

For example, for an update of `xen` on the stable branch, this could be:

```
xen: 4.19.3-unstable-2025-07-09 -> 4.19.3

[... commit message ...]

Not-cherry-picked-because: unstable is on a different minor version
```

This would then be shown as part of the automated review. The severity
of this will be downgraded from "warning" to "important". We still treat
the review as "changes requested", because it would be very complicated
and noisy to handle two different categories of reviews, some with
requested changes and some with comments only.

An alternative would be to not show this review at all. However, given
that the reviewers expectation on backports should already be "if it's
not a clean backport, the automated review will tell me what to look
at", it seems better to show these and have the committer confirm by
dismissing the review. Otherwise we risk merging actually unreviewed
commits.

(cherry picked from commit bf3607aa87)
2025-08-14 16:38:09 +00:00
Wolfgang Walther 3ef8956f74 workflows/check: use regular checkout
The filtered checkout we used before was a nice idea, but only worked
for small numbers of commits in a PR. It would fetch the whole history
initially, but only fetch objects on demand. This turns out to be much
too slow in a PR with 18 commits, regularly hitting the 10 minute
timeout, even when running it locally.

The new approach uses regular checkouts again. In contrast to the old
style, before we switched to the filtered checkout, this only fetches
exactly the commits we need - and all of them at once. This is
significantly faster than both other approaches, and scales much better.
A bigger number of commits doesn't have much of an effect, if any at
all.

(cherry picked from commit 0dff5ad6c5)
2025-08-13 19:15:10 +00:00
Wolfgang Walther d68bf37d63 ci/github-script/commits: harden code block rendering
To avoid rendering issues when diffing a markdown file with these
markers in context, just increase the markers length.

(cherry picked from commit 524a47b2b4)
2025-07-20 19:28:43 +00:00
Wolfgang Walther b10389b2ce Revert "ci/github-script/commits: keep formatting for diffs of markdown blocks"
This reverts commit b19798c8b0.

It lead to messed up formatting of the diff.

(cherry picked from commit 4a0c2c58a2)
2025-07-20 19:28:42 +00:00
Wolfgang Walther 6d867d1b0c ci/github-script/commits: fix job_url
This broke when we moved the check-cherry-picks workflow into the bigger
PR workflow. At this time, the "workflow run" became the whole PR
workflow, which includes many more than just 1 job, thus the assumption
in `jobs[0]` doesn't hold anymore.

(cherry picked from commit c4496912fd)
2025-07-17 10:12:42 +00:00
Wolfgang Walther ca425fc98d ci/github-script/commits: block on errors
Most of the checks we do for cherry-picks are dismissable warnings, with
one exception: When a commit hash has been found, but this hash is not
available in any of the pickable branches, we raise this with
severity=error. This should also *block* the merge and not be
dismissable. That's because this is a fixable issue in every case.

(cherry picked from commit 1fbcad0434)
2025-07-17 10:12:42 +00:00
Wolfgang Walther e2ac5f530c ci/github-script/commits: keep formatting for diffs of markdown blocks
Previously, when the diff contained a context line with ```, this would
end the code block and entirely break the markdown rendering.

Now we use the html code blocks provided by `core.summary` and properly
escape the content, so that it never escapes via html tags.

(cherry picked from commit b19798c8b0)
2025-07-17 10:12:42 +00:00
Wolfgang Walther a11220895f ci/github-script/commits: ignore whitespace on diff
This reduces noise that the cherry-pick reviews produce when formatting
related conflicts had to be resolved. We only do this in the
length-limited review comment, though. All changes, including
whitespace, can still be double-checked in the job log if needed.

(cherry picked from commit 40dcbb1483)
2025-07-17 10:12:42 +00:00
Wolfgang Walther 4ff7ede9c2 ci/github-script/commits: add comment about --creation-factor
(cherry picked from commit 84925b35c4)
2025-07-17 10:12:41 +00:00
Wolfgang Walther 7f19a6e408 ci/github-script/commits: init from ci/check-cherry-picks
This turns the check-cherry-pick script into a github-script based
JavaScript program. This makes it much easier to extend to check reverts
or merge commits later on.

(cherry picked from commit b46cb23251)
2025-07-16 10:26:08 +00:00