Skip to content

Commit 3403981

Browse files
authored
Attach some debug info to release runner errors (CleverRaven#79569)
* release notes debugging * Even more verbosity in debug logging
1 parent 47cac4a commit 3403981

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

build-scripts/generate-release-notes.js

+26-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@ const comittish = process.argv[4];
1616
const repo = process.env.REPOSITORY_NAME
1717
const owner = process.env.GITHUB_REPOSITORY_OWNER
1818

19+
function format_request_error(error) {
20+
// Octokit promises that all errors are https://github.com/octokit/request-error.js
21+
try {
22+
let out = `${error} (error ${error.name} code ${error.status})`;
23+
if (error.response?.data){
24+
// the response data is not the raw bytes we get from the server, but already
25+
// preprocessed and typified object. There's *probably* not much extra info
26+
// we can glean from this, but we shall try regardless
27+
out += "\n";
28+
let data = error.response.data;
29+
for(let key of Object.keys(data)){
30+
out += ` ${key}: ${data[key]}\n`
31+
}
32+
}
33+
return out;
34+
} catch (e) {
35+
return `${error}`;
36+
}
37+
}
38+
1939
async function main() {
2040
const client = github.getOctokit(token);
2141

@@ -28,9 +48,10 @@ async function main() {
2848
'X-GitHub-Api-Version': '2022-11-28',
2949
},
3050
}
31-
);
51+
).catch((e) =>{
52+
throw `${format_request_error(e)} ...when getting latest release`;
53+
})
3254

33-
let previousTag = null;
3455
if (latestReleaseResponse.data) {
3556
for (const responseData of latestReleaseResponse.data) {
3657
if (responseData.draft == false && responseData.prerelease == true) {
@@ -52,7 +73,9 @@ async function main() {
5273
'X-GitHub-Api-Version': '2022-11-28',
5374
},
5475
}
55-
);
76+
).catch((e) =>{
77+
throw `${format_request_error(e)} ...when asking github to autogenerate release notes since tag '${previousTag}'`;
78+
});
5679

5780
const noteSections = response.data.body?.split('\n\n');
5881
const trimmedSections = [];

0 commit comments

Comments
 (0)