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

fix: Comment on PR only if the XL label is new #83

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

leocencetti
Copy link
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

This PR addresses issue #19 by publishing the message_if_xl only when the xl_label is being added to the PR (either the first time, or when the size changes).
This behavior should cover most use cases while reducing spamming:

  • PR becomes XL --> Publish message (notify the author)
  • New changes pushed to an already XL PR --> No message (the author has already been notified once)
  • XL PR becomes M and then again XL --> Publish message (notify the author again)

The principle behind the solution is that the developer/author should be notified only when the PR becomes XL, and not every time a change is pushed to the same PR. Although discouraged, XL PRs are sometimes inevitable, and the developer is well aware of the number of changes he's working with...

Notes to Reviewer

There is potential to refactor the jq::base64 function into a more generic one that does not read the input from $file but from a positional argument instead. This would allow it to be reused as part of the proposed changes (instead of echo ${label} | base64 --decode | jq -r '.name').

How to test

  1. Create an L PR --> the Size: L label should be added
  2. Push enough changes to make it XL --> label should change to Size: XL and a comment should be published
  3. Push more changes (or re-run the workflow) --> Nothing happens (label stays the same, no comment)
  4. Manually change the label to Size: L (remove Size: XL), and rerun the workflow --> label should change to Size: XL and a second comment should be published

Link to issues addressed

@leocencetti
Copy link
Contributor Author

Hey @johnlk, any chance of this moving forward?

@johnlk
Copy link
Collaborator

johnlk commented Oct 10, 2024

Hey @johnlk, any chance of this moving forward?

For sure, happy to take a look.

Copy link
Collaborator

@johnlk johnlk left a comment

Choose a reason for hiding this comment

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

👏🏻 LGTM!

@leocencetti
Copy link
Contributor Author

@johnlk thanks for taking the time to review this! I can't seem to be able to merge this though...

@johnlk johnlk merged commit 2f1c419 into CodelyTV:main Oct 14, 2024
2 checks passed
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.

2 participants