Skip to content

Commit b53466e

Browse files
Merge pull request #1724 from apiraino/add_zulip_links_to_mcp_fcp
T-compiler meeting agenda: add Zulip discussion links to MCPs and FCPs
2 parents 2ab128e + ef295fe commit b53466e

File tree

4 files changed

+57
-5
lines changed

4 files changed

+57
-5
lines changed

src/actions.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ pub struct IssueDecorator {
5252
pub updated_at_hts: String,
5353

5454
pub fcp_details: Option<FCPDetails>,
55+
pub mcp_details: Option<MCPDetails>,
5556
}
5657

5758
#[derive(Serialize, Deserialize, Debug)]
@@ -62,6 +63,11 @@ pub struct FCPDetails {
6263
pub initiating_comment_content: String,
6364
}
6465

66+
#[derive(Serialize, Deserialize, Debug)]
67+
pub struct MCPDetails {
68+
pub zulip_link: String,
69+
}
70+
6571
lazy_static! {
6672
pub static ref TEMPLATES: Tera = {
6773
match Tera::new("templates/*") {
@@ -124,8 +130,21 @@ impl<'a> Action for Step<'a> {
124130
let query = query.clone();
125131
handles.push(tokio::task::spawn(async move {
126132
let _permit = semaphore.acquire().await?;
133+
let mcps_groups = [
134+
"mcp_new_not_seconded",
135+
"mcp_old_not_seconded",
136+
"mcp_accepted",
137+
"in_pre_fcp",
138+
"in_fcp",
139+
];
127140
let issues = query
128-
.query(&repository, name == "proposed_fcp", &gh)
141+
.query(
142+
&repository,
143+
name == "proposed_fcp",
144+
mcps_groups.contains(&name.as_str())
145+
&& repository.full_name.contains("rust-lang/compiler-team"),
146+
&gh,
147+
)
129148
.await?;
130149
Ok((name, kind, issues))
131150
}));

src/github.rs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,18 @@ impl Issue {
480480
Ok(comment)
481481
}
482482

483+
// returns an array of one element
484+
pub async fn get_first_comment(&self, client: &GithubClient) -> anyhow::Result<Vec<Comment>> {
485+
let comment_url = format!(
486+
"{}/issues/{}/comments?page=1&per_page=1",
487+
self.repository().url(),
488+
self.number,
489+
);
490+
Ok(client
491+
.json::<Vec<Comment>>(client.get(&comment_url))
492+
.await?)
493+
}
494+
483495
pub async fn edit_body(&self, client: &GithubClient, body: &str) -> anyhow::Result<()> {
484496
let edit_url = format!("{}/issues/{}", self.repository().url(), self.number);
485497
#[derive(serde::Serialize)]
@@ -1574,6 +1586,7 @@ impl<'q> IssuesQuery for Query<'q> {
15741586
&'a self,
15751587
repo: &'a Repository,
15761588
include_fcp_details: bool,
1589+
include_mcp_details: bool,
15771590
client: &'a GithubClient,
15781591
) -> anyhow::Result<Vec<crate::actions::IssueDecorator>> {
15791592
let issues = repo
@@ -1588,12 +1601,13 @@ impl<'q> IssuesQuery for Query<'q> {
15881601
};
15891602

15901603
let mut issues_decorator = Vec::new();
1604+
let re = regex::Regex::new("https://github.com/rust-lang/|/").unwrap();
1605+
let re_zulip_link = regex::Regex::new(r"\[stream\]:\s").unwrap();
15911606
for issue in issues {
15921607
let fcp_details = if include_fcp_details {
15931608
let repository_name = if let Some(repo) = issue.repository.get() {
15941609
repo.repository.clone()
15951610
} else {
1596-
let re = regex::Regex::new("https://github.com/rust-lang/|/").unwrap();
15971611
let split = re.split(&issue.html_url).collect::<Vec<&str>>();
15981612
split[1].to_string()
15991613
};
@@ -1626,6 +1640,18 @@ impl<'q> IssuesQuery for Query<'q> {
16261640
} else {
16271641
None
16281642
};
1643+
1644+
let mcp_details = if include_mcp_details {
1645+
let first_comment = issue.get_first_comment(&client).await?;
1646+
let split = re_zulip_link
1647+
.split(&first_comment[0].body)
1648+
.collect::<Vec<&str>>();
1649+
let zulip_link = split.last().unwrap_or(&"#").to_string();
1650+
Some(crate::actions::MCPDetails { zulip_link })
1651+
} else {
1652+
None
1653+
};
1654+
16291655
issues_decorator.push(crate::actions::IssueDecorator {
16301656
title: issue.title.clone(),
16311657
number: issue.number,
@@ -1645,6 +1671,7 @@ impl<'q> IssuesQuery for Query<'q> {
16451671
.join(", "),
16461672
updated_at_hts: crate::actions::to_human(issue.updated_at),
16471673
fcp_details,
1674+
mcp_details,
16481675
});
16491676
}
16501677

@@ -2112,6 +2139,7 @@ pub trait IssuesQuery {
21122139
&'a self,
21132140
repo: &'a Repository,
21142141
include_fcp_details: bool,
2142+
include_mcp_details: bool,
21152143
client: &'a GithubClient,
21162144
) -> anyhow::Result<Vec<crate::actions::IssueDecorator>>;
21172145
}
@@ -2123,6 +2151,7 @@ impl IssuesQuery for LeastRecentlyReviewedPullRequests {
21232151
&'a self,
21242152
repo: &'a Repository,
21252153
_include_fcp_details: bool,
2154+
_include_mcp_details: bool,
21262155
client: &'a GithubClient,
21272156
) -> anyhow::Result<Vec<crate::actions::IssueDecorator>> {
21282157
use cynic::QueryBuilder;
@@ -2249,6 +2278,7 @@ impl IssuesQuery for LeastRecentlyReviewedPullRequests {
22492278
assignees,
22502279
updated_at_hts,
22512280
fcp_details: None,
2281+
mcp_details: None,
22522282
}
22532283
},
22542284
)
@@ -2336,6 +2366,7 @@ impl IssuesQuery for DesignMeetings {
23362366
&'a self,
23372367
_repo: &'a Repository,
23382368
_include_fcp_details: bool,
2369+
_include_mcp_details: bool,
23392370
client: &'a GithubClient,
23402371
) -> anyhow::Result<Vec<crate::actions::IssueDecorator>> {
23412372
use github_graphql::project_items::ProjectV2ItemContent;
@@ -2350,6 +2381,7 @@ impl IssuesQuery for DesignMeetings {
23502381
assignees: String::new(),
23512382
number: issue.number.try_into().unwrap(),
23522383
fcp_details: None,
2384+
mcp_details: None,
23532385
html_url: issue.url.0,
23542386
title: issue.title,
23552387
repo_name: String::new(),

templates/_issue.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% macro render(issue, with_age="") %}"{{issue.title}}" [{{issue.repo_name}}#{{issue.number}}]({{issue.html_url}}){% if with_age %}(last review activity: {{issue.updated_at_hts}}){% endif %}{% endmacro %}
1+
{% macro render(issue, with_age="") %}"{{issue.title}}" [{{issue.repo_name}}#{{issue.number}}]({{issue.html_url}}){% if issue.mcp_details.zulip_link %} ([Zulip]({{issue.mcp_details.zulip_link}})){% endif %}{% if with_age %} (last review activity: {{issue.updated_at_hts}}){% endif %}{% endmacro %}

templates/prioritization_agenda.tt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type: docs
1212

1313
- (TIP) add here non-recurrent scheduled meetings, [check the schedule calendar](https://calendar.google.com/calendar/htmlembed?src=6u5rrtce6lrtv07pfi3damgjus%40group.calendar.google.com)
1414
- (TIP) mention upcoming Rust stable releases, [check the release calendar](https://calendar.google.com/calendar/htmlembed?src=l1b1gkqvfbgunjs18nemq4c580%40group.calendar.google.com)
15-
- Reminder: if you see a PR/issue that seems like there might be legal implications due to copyright/IP/etc, please let the Core team know (or at least message @_**pnkfelix** or @_**Wesley Wiser** so we can pass it along).
15+
- Reminder: if you see a PR/issue that seems like there might be legal implications due to copyright/IP/etc, please let us know (or at least message @_**davidtwco** or @_**Wesley Wiser** so we can pass it along).
1616

1717
### Other WG meetings ([calendar link](https://calendar.google.com/calendar/embed?src=6u5rrtce6lrtv07pfi3damgjus%40group.calendar.google.com))
1818

@@ -68,6 +68,7 @@ don't know
6868

6969
[T-compiler](https://github.com/rust-lang/rust/pulls?q=is%3Aopen+label%3AS-waiting-on-team+label%3AT-compiler)
7070
{{-issues::render(issues=prs_waiting_on_team_t_compiler, empty="No PRs waiting on `T-compiler` this time.")}}
71+
- Other issues [in progress or waiting on other teams](https://hackmd.io/XYr1BrOWSiqCrl8RCWXRaQ)
7172

7273
## Issues of Note
7374

@@ -124,4 +125,4 @@ don't know
124125
- @*WG-X* checkin by @**person1**
125126
- @*WG-X* checkin by @**person2**
126127

127-
Next meetings' agenda draft: `<hackmd link>`
128+
Next meetings' agenda draft: [hackmd link](#)

0 commit comments

Comments
 (0)