get-preview-channel-changes errors on invalid token (#9616)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-03-20 21:44:12 -06:00 committed by GitHub
parent ac4c6c60f1
commit 65c6bfebda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,8 +1,7 @@
#!/usr/bin/env node --redirect-warnings=/dev/null #!/usr/bin/env node --redirect-warnings=/dev/null
const { execFileSync } = require("child_process"); const { execFileSync } = require("child_process");
const { GITHUB_ACCESS_TOKEN } = process.env; let { GITHUB_ACCESS_TOKEN } = process.env;
const PR_REGEX = /#\d+/; // Ex: matches on #4241
const FIXES_REGEX = /(fixes|closes|completes) (.+[/#]\d+.*)$/im; const FIXES_REGEX = /(fixes|closes|completes) (.+[/#]\d+.*)$/im;
main(); main();
@ -20,26 +19,14 @@ async function main() {
// Print the previous release // Print the previous release
console.log(`Changes from ${oldTag} to ${newTag}\n`); console.log(`Changes from ${oldTag} to ${newTag}\n`);
let hasProtocolChanges = false; if (!GITHUB_ACCESS_TOKEN) {
try { try {
execFileSync("git", [ GITHUB_ACCESS_TOKEN = execFileSync("gh", ["auth", "token"]).toString();
"diff", } catch (error) {
oldTag, console.log(error);
newTag, console.log("No GITHUB_ACCESS_TOKEN, and no `gh auth token`");
"--exit-code", process.exit(1);
"--", }
"crates/rpc",
]).status != 0;
} catch (error) {
hasProtocolChanges = true;
}
if (hasProtocolChanges) {
console.warn(
"\033[31;1;4mRPC protocol changes, server should be re-deployed\033[0m\n",
);
} else {
console.log("No RPC protocol changes\n");
} }
// Get the PRs merged between those two tags. // Get the PRs merged between those two tags.
@ -69,7 +56,7 @@ async function main() {
// Print the pull request title and URL. // Print the pull request title and URL.
const pullRequest = await response.json(); const pullRequest = await response.json();
const releaseNotesHeader = /^\s*(?:Release )?Notes\s*:(.+)/ims; const releaseNotesHeader = /^\s*Release Notes:(.+)/ims;
let releaseNotes = pullRequest.body || ""; let releaseNotes = pullRequest.body || "";
const captures = releaseNotesHeader.exec(releaseNotes); const captures = releaseNotesHeader.exec(releaseNotes);