Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip or delete PR diff comments when empty #4520

Merged
merged 5 commits into from
Dec 11, 2023
Merged

Skip or delete PR diff comments when empty #4520

merged 5 commits into from
Dec 11, 2023

Conversation

colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Nov 30, 2023

This PR addresses some of the review comments in #4511 (review)

Skipping empty GitHub diff comments

We no longer post "No diff changes found." comments, except for:

  1. JavaScript changes to GitHub release
  2. Stylesheets changes to GitHub release

This reduces comment noise for day-to-day PRs but keeps the important two for GitHub releases

Empty comments

Deleting outdated GitHub diff comments

What if a PR had a diff and a comment was added

But another push results in no diff, so we'd be left with an outdated comment that was already posted

With the comment now out of date, we now remove it via GitHub REST API issues.deleteComment

@colinrotherham colinrotherham requested a review from a team as a code owner November 30, 2023 16:58
Copy link

github-actions bot commented Nov 30, 2023

📋 Stats

File sizes

File Size
dist/govuk-frontend-development.min.css 113.65 KiB
dist/govuk-frontend-development.min.js 38.28 KiB
packages/govuk-frontend/dist/govuk/all.bundle.js 77.78 KiB
packages/govuk-frontend/dist/govuk/all.bundle.mjs 73.09 KiB
packages/govuk-frontend/dist/govuk/all.mjs 3.86 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs 359 B
packages/govuk-frontend/dist/govuk/govuk-frontend.min.css 113.64 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.js 38.27 KiB
packages/govuk-frontend/dist/govuk/i18n.mjs 5.38 KiB

Modules

File Size
all.mjs 69.41 KiB
components/accordion/accordion.mjs 21.67 KiB
components/button/button.mjs 4.7 KiB
components/character-count/character-count.mjs 21.24 KiB
components/checkboxes/checkboxes.mjs 5.83 KiB
components/error-summary/error-summary.mjs 6.09 KiB
components/exit-this-page/exit-this-page.mjs 16.08 KiB
components/header/header.mjs 3.9 KiB
components/notification-banner/notification-banner.mjs 4.54 KiB
components/radios/radios.mjs 4.83 KiB
components/skip-link/skip-link.mjs 3.81 KiB
components/tabs/tabs.mjs 9.66 KiB

View stats and visualisations on the review app


Action run for aabe22d

@colinrotherham colinrotherham changed the title Skip diff comments when empty Skip PR diff comments when empty Dec 1, 2023
@colinrotherham colinrotherham changed the title Skip PR diff comments when empty Add PR diff comments in order, skip or delete when empty Dec 1, 2023
Copy link
Member

@romaricpascal romaricpascal left a comment

Choose a reason for hiding this comment

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

Cheers for digging into solutions for the comments on that PR 😊

I think there's a mix of things in this PR and we may want to split it into two:

  1. Adding comments in a consistent order sounds fairly uncontroversial and could go on its own
  2. Skipping or deleting when empty could use a bigger discussion, as we may still want a "no diff to output" comment that would reassure us that the diff did actually run (and that there wasn't a bug despite the workflow completing OK, for example).

In terms of code, the steps taken look generally fine. I'd be keen to keep the <!-- and --> wrapping the marker text inside the functions creating the comments (and now searching/deleting it), as it provides some safety that the marker won't be visible in the comment once posted.

@colinrotherham colinrotherham changed the title Add PR diff comments in order, skip or delete when empty Skip or delete PR diff comments when empty Dec 1, 2023
@colinrotherham colinrotherham changed the base branch from main to ordered-diff December 1, 2023 17:19
@colinrotherham
Copy link
Contributor Author

colinrotherham commented Dec 1, 2023

@romaricpascal Thanks

…Skipping or deleting when empty could use a bigger discussion, as we may still want a "no diff to output" comment that would reassure us that the diff did actually run (and that there wasn't a bug despite the workflow completing OK, for example).

☝️ Sounds good, let me know, I was happy with the noise at first but now they're everywhere 😱

I've only set skipEmpty: true on the ones I'd skip in 99eb358

This change reduces comment noise for PRs but keeps the important two for GitHub releases:

1. JavaScript changes to GitHub release
2. Stylesheets changes to GitHub release

They provide confirmation that the GitHub Action ran successfully
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4520 December 1, 2023 17:25 Inactive
Base automatically changed from ordered-diff to main December 1, 2023 17:31
@colinrotherham colinrotherham self-assigned this Dec 5, 2023
@colinrotherham
Copy link
Contributor Author

colinrotherham commented Dec 7, 2023

We discussed this at dev catch up so I'll add a summary 🙌

Essentially it felt a shame to delete "No diff changes found" PR comments but sadly the GitHub REST API for issues doesn't support the hide comment feature. It's only found in the GitHub GraphQL API as “minimising as OUTDATED”

Since we only added npm package diffs last week, we won't miss seeing empty comments

So to move forward we'll determine which PR diff comments can be skipped (or deleted) when empty

I've suggested we merge this PR which implements the following:

  1. Published npm package diffs can be skipped or deleted
  2. GitHub release diffs for CSS and JavaScript cannot be skipped or deleted

Then in future, for any skipped comments, can add a single combined summary in another PR

Copy link
Member

@romaricpascal romaricpascal left a comment

Choose a reason for hiding this comment

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

Let's reduce the noise for now, and think about how to get some certainty that things have ran OK in a future PR. I'll create an issue to track that.

Thanks for updating our set up 😊 ⛵

@colinrotherham colinrotherham merged commit 6d021e4 into main Dec 11, 2023
45 checks passed
@colinrotherham colinrotherham deleted the empty-diff branch December 11, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants