Skip to content

Commit 1f0fe3d

Browse files
author
Orta Therox
authored
Merge pull request #1084 from saschanaz/create-release
Pass string to createRelease()
2 parents a645106 + 4f5a366 commit 1f0fe3d

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

deploy/deployChangedPackages.mjs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import * as fs from "fs";
99
import { basename } from "path";
1010
import { spawnSync, execSync } from "child_process";
11-
import { Octokit } from "@octokit/core";
11+
import { Octokit } from "@octokit/rest";
1212
import printDiff from "print-diff";
1313
import { generateChangelogFrom } from "../lib/changelog.js";
1414
import { packages } from "./createTypesPackages.mjs";
@@ -36,8 +36,7 @@ for (const dirName of fs.readdirSync(generatedDir)) {
3636
.readdirSync(packageDir)
3737
.filter((f) => f.endsWith(".d.ts"));
3838

39-
/** @type {string[]} */
40-
let releaseNotes = [];
39+
let releaseNotes = "";
4140

4241
// Look through each .d.ts file included in a package to
4342
// determine if anything has changed
@@ -63,10 +62,10 @@ for (const dirName of fs.readdirSync(generatedDir)) {
6362
console.log(`Comparing ${file} from ${olderVersion}, to now:`);
6463
printDiff(oldFile, generatedDTSContent);
6564

66-
const title = `\n## \`${file}\`\n`;
65+
const title = `\n## \`${file}\`\n\n`;
6766
const notes = generateChangelogFrom(oldFile, generatedDTSContent);
68-
releaseNotes.push(title);
69-
releaseNotes.push(notes.trim() === "" ? "No changes" : notes);
67+
releaseNotes = title;
68+
releaseNotes += notes.trim() === "" ? "No changes" : notes;
7069

7170
upload = upload || oldFile !== generatedDTSContent;
7271
} catch (error) {
@@ -106,7 +105,7 @@ Assuming that this means we need to upload this package.`);
106105
}
107106

108107
console.log("\n# Release notes:");
109-
console.log(releaseNotes.join("\n"), "\n\n");
108+
console.log(releaseNotes, "\n\n");
110109
}
111110
// Warn if we did a dry run.
112111
if (!process.env.NODE_AUTH_TOKEN) {
@@ -124,7 +123,7 @@ async function createRelease(tag, body) {
124123
const octokit = new Octokit({ auth: authToken });
125124

126125
try {
127-
await octokit.request("POST /repos/{owner}/{repo}/releases", {
126+
await octokit.repos.createRelease({
128127
owner: "microsoft",
129128
repo: "TypeScript-DOM-lib-generator",
130129
tag_name: tag,

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"type": "module",
4141
"devDependencies": {
4242
"@mdn/browser-compat-data": "^3.3.13",
43+
"@octokit/rest": "^16.43.2",
4344
"@types/jsdom": "^16.2.13",
4445
"@types/node": "^16.4.8",
4546
"@types/node-fetch": "^2.5.12",

0 commit comments

Comments
 (0)