Skip to content

Commit 5a58413

Browse files
committed
Include all pull requests with an FCP in relnotes section
Almost all of the ones that were missing relnotes tags had an FCP when I wrote release notes recently.
1 parent 3d24feb commit 5a58413

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/main.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ fn main() {
6868
.any(|o| SKIP_LABELS.contains(&o["name"].as_str().unwrap()))
6969
});
7070

71+
let relnotes_tags = &["relnotes", "finished-final-comment-period"];
72+
7173
let links = map_to_link_items("", in_release.clone());
72-
let (relnotes, rest) = partition_by_tag(in_release, "relnotes");
74+
let (relnotes, rest) = partition_by_tag(in_release, relnotes_tags);
7375

7476
let (
7577
compat_relnotes,
@@ -85,7 +87,7 @@ fn main() {
8587
let cargo_issues = get_issues(start, end, "cargo");
8688

8789
let (cargo_relnotes, cargo_unsorted) = {
88-
let (relnotes, rest) = partition_by_tag(cargo_issues.iter(), "relnotes");
90+
let (relnotes, rest) = partition_by_tag(cargo_issues.iter(), relnotes_tags);
8991

9092
(
9193
map_to_line_items("cargo/", relnotes),
@@ -121,12 +123,13 @@ fn get_issues(start: Date<Utc>, end: Date<Utc>, repo_name: &'static str) -> Vec<
121123
use reqwest::blocking::Client;
122124
use reqwest::header::*;
123125

126+
let token = env::var("GITHUB_TOKEN").expect("Set GITHUB_TOKEN to a valid token");
124127
let mut headers = HeaderMap::new();
125128
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
126129
headers.insert(ACCEPT, "application/json".parse().unwrap());
127130
headers.insert(
128131
AUTHORIZATION,
129-
format!("Bearer {}", env::var("GITHUB_TOKEN").unwrap())
132+
format!("Bearer {}", token)
130133
.parse()
131134
.unwrap(),
132135
);
@@ -262,24 +265,24 @@ fn map_to_link_items<'a>(
262265

263266
fn partition_by_tag<'a>(
264267
iter: impl IntoIterator<Item = &'a json::Value>,
265-
tag: &str,
268+
tags: &[&str],
266269
) -> (JsonRefArray<'a>, JsonRefArray<'a>) {
267270
iter.into_iter().partition(|o| {
268271
o["labels"]["nodes"]
269272
.as_array()
270273
.unwrap()
271274
.iter()
272-
.any(|o| o["name"] == tag)
275+
.any(|o| tags.iter().any(|tag| o["name"] == *tag))
273276
})
274277
}
275278

276279
fn partition_prs<'a>(
277280
iter: impl IntoIterator<Item = &'a json::Value>,
278281
) -> (String, String, String, String, String) {
279-
let (compat_notes, rest) = partition_by_tag(iter, "C-future-compatibility");
280-
let (libs, rest) = partition_by_tag(rest, "T-libs");
281-
let (lang, rest) = partition_by_tag(rest, "T-lang");
282-
let (compiler, rest) = partition_by_tag(rest, "T-compiler");
282+
let (compat_notes, rest) = partition_by_tag(iter, &["C-future-compatibility"]);
283+
let (libs, rest) = partition_by_tag(rest, &["T-libs"]);
284+
let (lang, rest) = partition_by_tag(rest, &["T-lang"]);
285+
let (compiler, rest) = partition_by_tag(rest, &["T-compiler"]);
283286

284287
(
285288
map_to_line_items("", compat_notes),

0 commit comments

Comments
 (0)