tools: adding slackbot for PR notifications#16750
tools: adding slackbot for PR notifications#16750mattklein123 merged 16 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
alyssawilk
left a comment
There was a problem hiding this comment.
huh, I thought I ran format_pre locally before I sent this out. looking
tools/slack_tools/collect_prs.py
Outdated
|
|
||
| # If the PR hasn't been updated recently, don't nag. | ||
| # We can revisit this time, and always warn. | ||
| now = datetime.datetime.now() |
There was a problem hiding this comment.
If folks are likely to use this as their daily reminder, maybe we should warn for anything assigned? it is nice to have one place to look through
There was a problem hiding this comment.
Actually I'm just going to update this one now.
Thing I don't understand, how the datetime returned by github doesn't come with a time zone - I did not expect to have to do the shifting manually but the timestamps were off unless I did. If someone with better python skills has ideas lmk
| @@ -0,0 +1,192 @@ | |||
| # Script for collecting PRs in need of review, and informing maintainers via | |||
There was a problem hiding this comment.
It's up to you, but my preference is to just run this as a daily GH action cron. It looks like it should be pretty easy to use an action with code that exists in the repo: https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions?learn=getting_started#referencing-an-action-in-the-same-repository-where-a-workflow-file-uses-the-action.
Do you want to do this as a follow up or try to get this working now? I can help offline with credentials, etc.
There was a problem hiding this comment.
I think follow-up if that's OK
There was a problem hiding this comment.
Sure that's fine. Per offline convo I will help set up a GH action template that we can move this to in parallel.
phlax
left a comment
There was a problem hiding this comment.
hi @alyssawilk ive done a quick first review
its not clear to me how this code is triggered - im happy to review/test further once i understand better
tools/slack_tools/collect_prs.py
Outdated
| waiting_prs.append("PR %s' is tagged as waiting" % (pr_title)) | ||
| waiting = True | ||
| continue | ||
| if (waiting): |
tools/slack_tools/collect_prs.py
Outdated
| stalled_prs = "" | ||
|
|
||
| # Snag all PRs, including drafts | ||
| for pr_info in repo.get_pulls("open"): |
There was a problem hiding this comment.
this loop is quite long and hard to follow - is it possible to break into some functions - it would make it more expressive and allow a load of dedenting
tools/slack_tools/collect_prs.py
Outdated
|
|
||
|
|
||
| from slack_sdk import WebClient | ||
| from slack_sdk.errors import SlackApiError |
There was a problem hiding this comment.
these need to be at the top - but i guess ci has told you that already
tools/slack_tools/collect_prs.sh
Outdated
| @@ -0,0 +1,7 @@ | |||
| #!/bin/bash | |||
|
|
|||
| . tools/shell_utils.sh | |||
There was a problem hiding this comment.
im very much trying to get rid of this - can we use bazel for dependencies?
There was a problem hiding this comment.
Do we have examples of scripts that run that way? my tooling skills are pretty weak so I just copied this from one of the other scrips
There was a problem hiding this comment.
i can follow up after and shift this to bazel if thats helpful
There was a problem hiding this comment.
Ultimately we are going to run this as a GH action. I think it will be much easier if we just stick with raw pip for this tool since I think it will be trivial to get running in GHA. So I think the end result here is we will lose the SH file and just keep the requirements.txt file. I will follow up once I do a template for GHA.
There was a problem hiding this comment.
if we are using gh actions to trigger this we probs want to use something like this i think https://github.com/marketplace/actions/pip-installer
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
alyssawilk
left a comment
There was a problem hiding this comment.
ah, CI failure is dependabot. I'm going to fix in the next push becasue I'm not sure if the way phlax is suggesting I rework deps will change
tools/slack_tools/collect_prs.sh
Outdated
| @@ -0,0 +1,7 @@ | |||
| #!/bin/bash | |||
|
|
|||
| . tools/shell_utils.sh | |||
There was a problem hiding this comment.
Do we have examples of scripts that run that way? my tooling skills are pretty weak so I just copied this from one of the other scrips
| @@ -0,0 +1,192 @@ | |||
| # Script for collecting PRs in need of review, and informing maintainers via | |||
There was a problem hiding this comment.
I think follow-up if that's OK
tools/slack_tools/collect_prs.py
Outdated
| pass # Python 3 | ||
|
|
||
| maintainers = { | ||
| Maintainers = { |
There was a problem hiding this comment.
sorry to be annoying - the convention for constants in python is all caps - ie MAINTAINERS
There was a problem hiding this comment.
haha, not annoying at all. I thought that request was kinda weird because I read it as Maintainers - makes much more sense w.r.t. python style now I'm not misreading it!
|
Any other requests for the scripts? If not should I move them to .github/actions/pr_notifier/ ? |
|
@alyssawilk I would say let's move it and wire it up. We can launch and iterate. I will help you with the secret stuff offline. |
| @@ -0,0 +1,22 @@ | |||
| on: | |||
There was a problem hiding this comment.
I would recommend leaving the manual trigger option that I had in the example. This will allow you to manually trigger it from the UI to test it and also if for whatever reason the run fails and we want to run it.
.github/workflows/pr_notifier.yml
Outdated
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r ./.github/actions/pr_notifier/requirements.txt | ||
| - name: Display Python version |
.github/workflows/pr_notifier.yml
Outdated
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r ./.github/actions/pr_notifier/requirements.txt | ||
| - name: Display Python version |
There was a problem hiding this comment.
You will need to add the env var for the token secret here.
mattklein123
left a comment
There was a problem hiding this comment.
Awesome!!! I would just force merge it and you can test it manually.
|
@alyssawilk this still needs the dependabot setup i think |
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
We've been having PRs slipping through the cracks because repokitten assigns API reviewers and maintainer-on-call sees PRs as assigned and doesn't necessarily tag a maintainer for review.
Also adding hopefully helpful reminders for PRs which get stale. These will be less useful if folks don't use the waiting tag when waiting for response so will kick off a discussion thread on #maintainers about that
Risk Level: n/a
Testing: manual
Docs Changes: n/a
Release Notes: n/a
co-authored-by: mattklein123