-
Notifications
You must be signed in to change notification settings - Fork 77
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
Triagebot learns how to comment on GitHub #1690
base: master
Are you sure you want to change the base?
Conversation
Cargo.toml
Outdated
@@ -44,6 +44,7 @@ rand = "0.8.5" | |||
ignore = "0.4.18" | |||
postgres-types = { version = "0.2.4", features = ["derive"] } | |||
cron = { version = "0.12.0" } | |||
urlencoding = "2.1.2" |
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.
new dependency. not happy about that but I think I need to urlencode the Zulip message URL
src/zulip.rs
Outdated
ty: CommentType, | ||
) -> anyhow::Result<String> { | ||
// retrieve the original Zulip message to build the complete URL | ||
let zulip_msg = get_zulip_msg(ctx, message.id).await?; |
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.
here I get again the full message froim Zulip to rebuild the full message URL to backlink to Zulip che discussion about the assigned priority to the issue
#[derive(PartialEq)] | ||
enum CommentType { | ||
AssignIssuePriority, | ||
} |
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.
I was thinking we can send multiple message type to github ...
comment = format!( | ||
"WG-prioritization assigning priority ([Zulip discussion]({})) | ||
\n\n@rustbot label -I-prioritize +{}", | ||
zulip_msg_link, p_label | ||
); |
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.
body of the comment that will be created on github. unsure how those newlines behave
src/zulip.rs
Outdated
let zulip_stream = "245100-t-compiler/wg-prioritization/alerts"; | ||
let mut zulip_msg_link = format!( | ||
"https://rust-lang.zulipchat.com/#narrow/stream/{}/topic/{}/near/{}", | ||
zulip_stream, zulip_msg.message.subject, message.id | ||
); | ||
// Encode url and replace "%" with "." | ||
// (apparently Zulip does that to public URLs) | ||
urlencoding::encode(&zulip_msg_link); | ||
zulip_msg_link = zulip_msg_link.replace("%", "."); |
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 final Zulip link should look something like this:
https://rust-lang.zulipchat.com/#narrow/stream/245100-t-compiler.2Fwg-prioritization.2Falerts/topic/.23107094.20.60rustdoc.20--version.20--verbose.60.20no.20longer.20displays.20co.E2.80.A6/near/350696000
Where the only dynamic parts are the Zulip topic and the ID of the message
e50aef6
to
51013c9
Compare
In this first version triagebot learns how to post a comment on GitHub to assign priority to an issue marked as regression. The code should allow for any kind of comment to be created.
51013c9
to
22b1128
Compare
In this first version the triagebot learns how to post a comment on GitHub to assign priority to an issue that is marked as regression. The command is sent by the Zulip Rust lang chat instance. The syntax is:
@triagebot prio #issue <P-label>
example
@triagebot prio #123456 <P-high
The posted comment on GitHub will look like:
The
zulip-topic-link
part of the message is retrieved by querying the Zulip API by the message ID the webhook should send the triagebot.I'd like the code to allow for any kind of comment to be created (but that will require a bit of refinement). Another interesting usecase: easier beta backport accept/decline during T-compiler weekly triage meeting (mentioned a while ago on Zulip) - though this is a bit more trickier because ideally I'd like to backlink a specific message from a Zulip topic.
To really test this webhook I'll need a Zulip test instance (either local or hosted one on their free tier)