@samitouri / QOS-React / commits / 1052a5f2dd

[compiler:publish] Don't check branch in debug mode

ghstack-source-id: 465f5a358096c55310ebf5a0beef581646ab553e Pull Request resolved: https://github.com/facebook/react/pull/29153

Lauren Tan committed May 17, 2024 at 14:55 UTC 1052a5f2dd1c7e73b74661e70283fc825012ef67
1 file changed +11 -7
compiler/scripts/release/publish-manual.js
+11 -7
@@ -70,13 +70,6 @@ async function getDateStringForCommit(commit) {
70 * the command only report what it would have done, instead of actually publishing to npm.
71 */
72 async function main() {
73 - const currBranchName = await execHelper("git rev-parse --abbrev-ref HEAD");
74 - const isPristine = (await execHelper("git status --porcelain")) === "";
75 - if (currBranchName !== "main" || isPristine === false) {
76 - throw new Error(
77 - "This script must be run from the `main` branch with no uncommitted changes",
78 - );
79 - }
73 const argv = yargs(process.argv.slice(2))
74 .option("packages", {
75 description: "which packages to publish, defaults to all",
@@ -100,6 +93,17 @@ async function main() {
93 .parseSync();
94
95 const { packages, forReal, debug } = argv;
96 +
97 + if (debug === false) {
98 + const currBranchName = await execHelper("git rev-parse --abbrev-ref HEAD");
99 + const isPristine = (await execHelper("git status --porcelain")) === "";
100 + if (currBranchName !== "main" || isPristine === false) {
101 + throw new Error(
102 + "This script must be run from the `main` branch with no uncommitted changes",
103 + );
104 + }
105 + }
106 +
107 let pkgNames = packages;
108 if (Array.isArray(packages) === false) {
109 pkgNames = [packages];