mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-10 20:20:12 +00:00
A few fixes and updates
1. Fix package.json formatting. 2. Adapt copied code from TS.
This commit is contained in:
@@ -17,9 +17,9 @@
|
||||
"scripts": {
|
||||
"compile-scripts": "tsc -p scripts",
|
||||
"not-needed": "node scripts/not-needed.js",
|
||||
"update-codeowners": "node scripts/update-codeowners.js"
|
||||
"update-codeowners": "node scripts/update-codeowners.js",
|
||||
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed",
|
||||
"lint": "dtslint types",
|
||||
"lint": "dtslint types"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dtslint": "latest",
|
||||
|
||||
@@ -21,10 +21,11 @@ async function main() {
|
||||
}
|
||||
|
||||
const userName = process.env.GH_USERNAME;
|
||||
const token = process.env.GH_TOKEN;
|
||||
const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"]
|
||||
const now = new Date();
|
||||
const branchName = `codeowner-update-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}`;
|
||||
const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/DefinitelyTyped.git`;
|
||||
const remoteUrl = `https://${process.env.GH_TOKEN}@github.com/${userName}/DefinitelyTyped.git`;
|
||||
runSequence([
|
||||
["git", ["checkout", "."]], // reset any changes
|
||||
]);
|
||||
@@ -42,12 +43,11 @@ runSequence([
|
||||
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
|
||||
]);
|
||||
|
||||
const opts = { timeout: 100000, shell: true, stdio: "inherit" }
|
||||
/** @param {[string, string[]][]} tasks */
|
||||
function runSequence(tasks) {
|
||||
for (const task of tasks) {
|
||||
console.log(`${task[0]} ${task[1].join(" ")}`);
|
||||
const result = cp.spawnSync(task[0], task[1], opts);
|
||||
const result = cp.spawnSync(task[0], task[1], { timeout: 100000, shell: true, stdio: "inherit" });
|
||||
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
|
||||
}
|
||||
}
|
||||
@@ -61,18 +61,17 @@ function padNum(number) {
|
||||
const gh = new Octokit();
|
||||
gh.authenticate({
|
||||
type: "token",
|
||||
token: process.argv[2]
|
||||
token: process.env.GH_TOKEN,
|
||||
});
|
||||
gh.pulls.create({
|
||||
owner: process.env.TARGET_FORK,
|
||||
repo: "DefinitelyTyped",
|
||||
maintainer_can_modify: true,
|
||||
title: `🤖 User test baselines have changed`,
|
||||
title: `🤖 Codeowners have changed`,
|
||||
head: `${userName}:${branchName}`,
|
||||
base: "master",
|
||||
body:
|
||||
`Please review the diff and merge if no changes are unexpected.
|
||||
You can view the build log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary).
|
||||
|
||||
cc ${reviewers.map(r => "@" + r).join(" ")}`,
|
||||
}).then(r => {
|
||||
|
||||
Reference in New Issue
Block a user