From b5d4f5cd06826ec647c1cbc76bf26a51c28d3c0d Mon Sep 17 00:00:00 2001 From: Dennis Korpel Date: Mon, 17 Aug 2026 20:43:57 +0200 Subject: [PATCH] changed.d: authenticate with Bearer prefix, count GitHub issues in header --- .gitignore | 1 + changed.d | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 78bb16556f..2956460f7f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ GNUmakefile /tests_extractor /dtools_* /dub.selections.json +/token.txt diff --git a/changed.d b/changed.d index 776e9ed69e..bff5206fc6 100755 --- a/changed.d +++ b/changed.d @@ -406,7 +406,7 @@ GithubIssue[] getGithubIssuesRest(const string project, const string repo HTTP http = HTTP(url); http.addRequestHeader("Accept", "application/vnd.github+json"); http.addRequestHeader("X-GitHub-Api-Version", "2022-11-28"); - http.addRequestHeader("Authorization", bearer); + http.addRequestHeader("Authorization", bearer.startsWith("Bearer ") ? bearer : "Bearer " ~ bearer); char[] response; int statusCode; @@ -864,12 +864,16 @@ Please supply a bugzilla version with(changelogStats) { auto changelog = changelogEntries > 0 ? "%d major change%s and".format(changelogEntries, changelogEntries > 1 ? "s" : "") : ""; - w.put("$(VER) comes with {changelogEntries} {bugzillaIssues} fixed Bugzilla issue{bugzillaIssuesPlural}. + size_t githubIssues; + foreach (repo; githubChanges) + foreach (issues; repo) + githubIssues += issues.length; + w.put("$(VER) comes with {changelogEntries} {githubIssues} fixed GitHub issue{githubIssuesPlural}. A huge thanks goes to the $(LINK2 #contributors, {nrContributors} contributor{nrContributorsPlural}) who made $(VER) possible." - .replace("{bugzillaIssues}", bugzillaIssues.text) - .replace("{bugzillaIssuesPlural}", bugzillaIssues != 1 ? "s" : "") + .replace("{githubIssues}", githubIssues.text) + .replace("{githubIssuesPlural}", githubIssues != 1 ? "s" : "") .replace("{changelogEntries}", changelog) .replace("{nrContributors}", contributors.text) .replace("{nrContributorsPlural}", contributors != 1 ? "s" : "")