Skip to content

workflows/check-cherry-picks: post review comments#412068

Merged
wolfgangwalther merged 6 commits intoNixOS:masterfrom
wolfgangwalther:ci-cherry-pick-comments
Jun 1, 2025
Merged

workflows/check-cherry-picks: post review comments#412068
wolfgangwalther merged 6 commits intoNixOS:masterfrom
wolfgangwalther:ci-cherry-pick-comments

Conversation

@wolfgangwalther
Copy link
Contributor

@wolfgangwalther wolfgangwalther commented May 29, 2025

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.

Discussed in #411709 (comment)

Note: The full content of an example comment for this PR can be found in the summary page for the check-cherry-picks workflow. This is an example based on this PR, which is not a backport, so will only raise warnings for each commit, because there is no commit hash to pick. The workflow can't post the comment in this PR, because it runs in the pull_request context right now, which doesn't have the permissions to do so. Posting review comments will only work once the workflow runs in the pull_request_target context after merge.

The example doesn't contain a sample of the "please review the diff" case. In this case there will be a collapsable diff displayed in the warning, which is created as a github codeblock of type diff. This gives some basic colors for added/removed lines. In the summary page, the commit hashes are display as raw values, but in the comment GitHub will automatically turn them into links to the actual commits, which also allow hovering over them to see the commit message.

Things done

  • Tested the script locally.
  • Tested the actions in my fork.
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 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 backport release-25.05 labels May 29, 2025
@wolfgangwalther wolfgangwalther force-pushed the ci-cherry-pick-comments branch from 8a607e5 to 67ef23f Compare May 29, 2025 12:30
@github-actions github-actions bot 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. labels May 29, 2025
@wolfgangwalther wolfgangwalther force-pushed the ci-cherry-pick-comments branch from 67ef23f to 672b61d Compare May 29, 2025 12:34
@wolfgangwalther wolfgangwalther marked this pull request as ready for review May 29, 2025 12:41
@wolfgangwalther
Copy link
Contributor Author

I copy&pasted together an example of what the different errors/warnings look like. This was not a real run, but I just didn't feel like re-creating an example that does all 3 failure modes at once. Here's a screenshot:

2025-05-29T14:46:34,496670609+02:00

(the details toggle starts in a closed state, I opened that manually)

@JohnRTitor
Copy link
Member

JohnRTitor commented May 29, 2025

the workflow will now post review comments as "Request Changes".

Sometimes we have to modify a commit, for conflict resolution. This is bad, it'll block the PR, as commiters have the permission to "block" the PR by "requesting changes". nixpkgs-ci in the sense is also a commiter.

IMO, review "Comment" should be used instead.

image

Copy link
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

I always struggle to review (or develop) github actions/workflows with any confidence. But I don't see any obvious issues on an initial read-through of the patches.

@MattSturgeon
Copy link
Contributor

MattSturgeon commented May 29, 2025

the workflow will now post review comments as "Request Changes".

Sometimes we have to modify a commit, for conflict resolution. This is bad, it'll block the PR, as commiters have the permission to "block" the PR by "requesting changes". nixpkgs-ci in the sense is also a commiter.

IMO, review "Comment" should be used instead.

I disagree. Anyone who can merge a PR can also dismiss a "Request changes" review.

This being a manual step encourages the reviewer to actually check whether the review should be dismissed or not.

Example

Screenshot From 2025-05-29 14-08-38
Screenshot From 2025-05-29 14-08-52

The generated review text explicitly mentions that committers should dismiss the review if it is invalid.

@wolfgangwalther

This comment was marked as duplicate.

@wolfgangwalther wolfgangwalther force-pushed the ci-cherry-pick-comments branch 4 times, most recently from c58a86d to 9a08b5b Compare May 29, 2025 19:27
@risicle
Copy link
Contributor

risicle commented May 29, 2025

So glad this is getting some more love

@JohnRTitor
Copy link
Member

JohnRTitor commented May 30, 2025

I disagree. Anyone who can merge a PR can also dismiss a "Request changes" review.

All's well until you have to (force) push multiple times, and you'll be spammed with a message and request changes.

This is exactly why 38003ce was reverted .

With the reason being:

I will now always get a notification even if no human has responded to my PR.

Yeah. Annoying.

(#361388 (comment))

@wolfgangwalther wolfgangwalther force-pushed the ci-cherry-pick-comments branch 5 times, most recently from 8b8bbaf to 22d0c0b Compare May 31, 2025 14:47
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.

Love the pagination!

@wolfgangwalther wolfgangwalther force-pushed the ci-cherry-pick-comments branch from 22d0c0b to 176c905 Compare May 31, 2025 15:24
@wolfgangwalther

This comment was marked as resolved.

@wolfgangwalther wolfgangwalther force-pushed the ci-cherry-pick-comments branch from 176c905 to 81b5935 Compare June 1, 2025 07:35
The command substitution style we recently switched to strips trailing
newlines, so we don't need to check for empty lines anymore.
This way it's a bit more centralized and easier to extend.
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.
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.
@wolfgangwalther wolfgangwalther force-pushed the ci-cherry-pick-comments branch from 81b5935 to 856792f Compare June 1, 2025 07:36
@wolfgangwalther
Copy link
Contributor Author

I think we put enough effort into this to just try it now. We can always iterate later.

@wolfgangwalther wolfgangwalther merged commit 80e3aa3 into NixOS:master Jun 1, 2025
14 of 18 checks passed
@wolfgangwalther wolfgangwalther deleted the ci-cherry-pick-comments branch June 1, 2025 07:41
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Jun 1, 2025

Successfully created backport PR for release-25.05:

@github-actions github-actions bot added the 8.has: port to stable This PR already has a backport to the stable release. label Jun 1, 2025
Copy link
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

Nice job! 👏

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 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. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants