mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-15 22:15:18 -05:00
Switch references to master to main in the codebase + validating infra post-main migration (#44347)
* Update package.json * Remove references to master in the codebase * Add more master - main
This commit is contained in:
@@ -8,16 +8,16 @@ const userName = process.env.GH_USERNAME || "typescript-bot";
|
||||
const reviewers = process.env.REQUESTING_USER ? [process.env.REQUESTING_USER] : ["weswigham", "sandersn", "RyanCavanaugh"];
|
||||
const now = new Date();
|
||||
const masterBranchname = `user-baseline-updates`;
|
||||
const targetBranch = process.env.TARGET_BRANCH || "master";
|
||||
const branchName = process.env.TARGET_FORK?.toLowerCase() === "microsoft" && (targetBranch === "master" || targetBranch === "refs/heads/master")
|
||||
const targetBranch = process.env.TARGET_BRANCH || "main";
|
||||
const branchName = process.env.TARGET_FORK?.toLowerCase() === "microsoft" && (targetBranch === "main" || targetBranch === "refs/heads/main")
|
||||
? masterBranchname
|
||||
: `user-update-${process.env.TARGET_FORK}-${process.env.TARGET_BRANCH ? "-" + process.env.TARGET_BRANCH : ""}`;
|
||||
const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`;
|
||||
const baseRef = branchName === masterBranchname ? "master" : masterBranchname;
|
||||
const baseRef = branchName === masterBranchname ? "main" : masterBranchname;
|
||||
runSequence([
|
||||
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
|
||||
["git", ["checkout", "."]], // reset any changes
|
||||
["git", ["fetch", baseRef === "master" ? "origin" : "fork", baseRef]], // fetch target ref in case it's not present locally
|
||||
["git", ["fetch", baseRef === "main" ? "origin" : "fork", baseRef]], // fetch target ref in case it's not present locally
|
||||
["git", ["checkout", baseRef]], // move head to target
|
||||
["node", ["./node_modules/gulp/bin/gulp.js", "baseline-accept"]], // accept baselines
|
||||
["git", ["checkout", "-b", branchName]], // create a branch
|
||||
@@ -36,7 +36,7 @@ gh.pulls.create({
|
||||
maintainer_can_modify: true,
|
||||
title: `🤖 User test baselines have changed` + (process.env.TARGET_BRANCH ? ` for ${process.env.TARGET_BRANCH}` : ""),
|
||||
head: `${userName}:${branchName}`,
|
||||
base: branchName === masterBranchname ? "master" : masterBranchname,
|
||||
base: branchName === masterBranchname ? "main" : masterBranchname,
|
||||
body:
|
||||
`${process.env.SOURCE_ISSUE ? `This test run was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.SOURCE_ISSUE} `+"\n" : ""}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).
|
||||
|
||||
@@ -34,8 +34,8 @@ async function main() {
|
||||
// Forcibly cleanup workspace
|
||||
runSequence([
|
||||
["git", ["checkout", "."]],
|
||||
["git", ["fetch", "-fu", "origin", "master:master"]],
|
||||
["git", ["checkout", "master"]],
|
||||
["git", ["fetch", "-fu", "origin", "main:main"]],
|
||||
["git", ["checkout", "main"]],
|
||||
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
|
||||
]);
|
||||
|
||||
@@ -51,15 +51,15 @@ async function main() {
|
||||
owner: "Microsoft",
|
||||
repo: "TypeScript",
|
||||
issue_number: num,
|
||||
body: `This PR is configured as an experiment, and currently has rebase conflicts with master - please rebase onto master and fix the conflicts.`
|
||||
body: `This PR is configured as an experiment, and currently has rebase conflicts with main - please rebase onto main and fix the conflicts.`
|
||||
});
|
||||
}
|
||||
throw new Error(`Rebase conflict detected in PR ${num} with master`); // A PR is currently in conflict, give up
|
||||
throw new Error(`Rebase conflict detected in PR ${num} with main`); // A PR is currently in conflict, give up
|
||||
}
|
||||
runSequence([
|
||||
["git", ["fetch", "origin", `pull/${num}/head:${num}`]],
|
||||
["git", ["checkout", `${num}`]],
|
||||
["git", ["rebase", "master"]],
|
||||
["git", ["rebase", "main"]],
|
||||
["git", ["push", "-f", "-u", "fork", `${num}`]], // Keep a rebased copy of this branch in our fork
|
||||
]);
|
||||
|
||||
@@ -71,7 +71,7 @@ async function main() {
|
||||
|
||||
// Return to `master` and make a new `experimental` branch
|
||||
runSequence([
|
||||
["git", ["checkout", "master"]],
|
||||
["git", ["checkout", "main"]],
|
||||
["git", ["checkout", "-b", "experimental"]],
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user