-
Notifications
You must be signed in to change notification settings - Fork 51
Conversation
return Urgency("low", 5) | ||
|
||
|
||
def days_without_weekends(today: datetime, delta: timedelta) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be super cool if we could also get the AFK status here...
The DAG does not ping on Saturday and Sunday and accounts for weekend days | ||
when determining how much time has passed since the review. | ||
|
||
Unfortunately the DAG does not know when someone is on vacation. It is up to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The answer to my comment above is here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be a great addition to our workflow!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!! I'm very excited to have this as part of our workflow 🚀
I'm not sure how to test the other stuff as it all depends on GitHub responses. I could record some of them but it's a real pain without setting up infrastructure for that.
I think that's a solid idea, it's what we do for the provider API script tests: https://github.com/WordPress/openverse-catalog/tree/main/tests/dags/providers/provider_api_scripts/resources.
One more point I noticed while looking over this again - currently this is the structure:
The
What do you think? This puts the PR review specific code next to the DAG, since I think we're unlikely to reuse those functions in the same way we could reuse |
Thanks for the thorough review @AetherUnbound. This should be ready for another one now. |
class Urgency: | ||
@dataclass | ||
class Urgency: | ||
label: str | ||
days: int | ||
|
||
CRITICAL = Urgency("critical", 1) | ||
HIGH = Urgency("high", 2) | ||
MEDIUM = Urgency("medium", 4) | ||
LOW = Urgency("low", 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's kind of annoying that you can't reference a class within its own definition. I wish there was something like an enum that also allowed for complex, named values. This is probably the first time I've ever thought to myself "wow I really wish
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! These tests are super thorough 🚀 Just a couple of requests/questions, nothing to stop a merge.
Now() manager patches datetime return a fixed, settable, value | ||
(freezes time) | ||
|
||
https://stackoverflow.com/a/28073449 CC BY-SA 3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for including this!
tests/factories/github/__init__.py
Outdated
_pr_count = 1 | ||
|
||
|
||
def make_pull(priority: Urgency, past_due: bool) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind adding a docstring here describing what this function does? I'm having a hard time following everything it's referencing.
tests/factories/github/__init__.py
Outdated
|
||
for label in pull["labels"]: | ||
if "priority" in label["name"]: | ||
label.update(**_make_label(priority)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this step necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the priority label on the PR to determine the urgency of the PR, so we have to update the priority label in the pull.json fixture to have the configured urgency. This allows us to test all four urgency levels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh! So it's replacing whatever's in the fixture with what you're using in the test, makes sense 💯
Fixes
Fixes WordPress/openverse#1540 by @zackkrida
Description
Adds a new DAG to run daily and get PR review reminders.
Testing Instructions
Checkout this PR locally, add a GitHub PAT with access to the relevant repositories, and do a dry run to check if it will ping as expected.
Also check out the unit tests.
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin