Skip to content

Commit 9e17f1a

Browse files
authored
Merge pull request #72 from tmandry/improvements
Look for FCP issues, improve output somewhat
2 parents 0af5cc6 + 771eed6 commit 9e17f1a

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sections where possible, and prints the document to `stdout`.
66

77
## Requirements
88
`relnotes` uses the GitHub API to generate the release notes, as such you need
9-
a valid GitHub API key. `relnotes` will look for `GITHUB_API_KEY` in the
9+
a valid GitHub API key. `relnotes` will look for `GITHUB_TOKEN` in the
1010
environment and use that key when sending requests.
1111

1212
**small warning:** `relnotes` makes a lot of requests as GitHub only allows you to

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),

templates/relnotes.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@ Language
66
**relnotes**
77
{{language_relnotes}}
88

9+
**other**
910
{{language_unsorted}}
1011

1112
Compiler
1213
--------
1314
**relnotes**
1415
{{compiler_relnotes}}
1516

17+
**other**
1618
{{compiler_unsorted}}
1719

1820
Libraries
1921
---------
2022
**relnotes**
2123
{{libraries_relnotes}}
2224

25+
**other**
2326
{{libraries_unsorted}}
2427

2528
Stabilized APIs
@@ -30,6 +33,7 @@ Cargo
3033
**relnotes**
3134
{{cargo_relnotes}}
3235

36+
**other**
3337
{{cargo_unsorted}}
3438

3539
Misc
@@ -40,13 +44,22 @@ Compatibility Notes
4044
**relnotes**
4145
{{compat_relnotes}}
4246

47+
**other**
4348
{{compat_unsorted}}
4449

50+
Internal Changes
51+
----------------
52+
53+
These changes provide no direct user facing benefits, but represent significant
54+
improvements to the internals and overall performance of rustc
55+
and related tools.
56+
4557
UNSORTED
4658
--------
4759
**relnotes**
4860
{{unsorted_relnotes}}
4961

62+
**other**
5063
{{unsorted}}
5164

5265
{{links}}

0 commit comments

Comments
 (0)