Skip to content

Commit

Permalink
[tools] Update default branch to main
Browse files Browse the repository at this point in the history
  • Loading branch information
brentvatne committed Jan 26, 2022
1 parent 4c31b57 commit 168ee43
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion tools/src/Git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export class GitDirectory {
static async shallowCloneAsync(
directory: string,
remoteUrl: string,
ref: string = 'master'
ref: string = 'main'
): Promise<GitDirectory> {
const git = new GitDirectory(directory);

Expand Down
2 changes: 1 addition & 1 deletion tools/src/check-packages/getPackagesToCheckAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default async function getPackagesToCheckAsync(options: ActionOptions) {
});
}

const sinceRef = options.since ?? 'master';
const sinceRef = options.since ?? 'main';
const mergeBase = await safeGetMergeBaseAsync(sinceRef);

if (!mergeBase) {
Expand Down
2 changes: 1 addition & 1 deletion tools/src/code-review/reviewers/checkMissingChangelogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default async function ({ pullRequest, diff }: ReviewInput): Promise<Revi
return {
status: ReviewStatus.WARN,
title: 'Missing changelog entries',
body: `Your changes should be noted in the changelog. Read [Updating Changelogs](https://github.com/expo/expo/blob/master/guides/contributing/Updating%20Changelogs.md) guide and consider (it's optional) adding an appropriate entry to the following changelogs:
body: `Your changes should be noted in the changelog. Read [Updating Changelogs](https://github.com/expo/expo/blob/main/guides/contributing/Updating%20Changelogs.md) guide and consider (it's optional) adding an appropriate entry to the following changelogs:
${changelogLinks}`,
};
}
Expand Down
2 changes: 1 addition & 1 deletion tools/src/commands/AddChangelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default (program: Command) => {
)
.option(
'--no-pull-request',
'If changes were pushed directly to the master.',
'If changes were pushed directly to the main.',
(value, previous) => {
// we need to change how no-flag works in commander to be able to pass an array
if (!value) {
Expand Down
4 changes: 2 additions & 2 deletions tools/src/commands/CheckPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default (program: Command) => {
.alias('check', 'cp')
.option(
'-s, --since <commit>',
'Reference to the commit since which you want to run incremental checks. Defaults to HEAD of the master branch.',
'master'
'Reference to the commit since which you want to run incremental checks. Defaults to HEAD of the main branch.',
'main'
)
.option('-a, --all', 'Whether to check all packages and ignore `--since` option.', false)
.option('--no-build', 'Whether to skip `yarn build` check.', false)
Expand Down
4 changes: 2 additions & 2 deletions tools/src/commands/GenerateSDKDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function action(options) {

console.log(`Updating ${chalk.cyan('react-native-website')} submodule...`);

await spawnAsync('git', ['checkout', 'master'], {
await spawnAsync('git', ['checkout', 'main'], {
cwd: reactNativeWebsiteDir,
});

Expand Down Expand Up @@ -80,7 +80,7 @@ async function action(options) {
const apiFilePath = path.join(targetSdkDirectory, 'sdk', api);
await transformFileAsync(apiFilePath, [
{
find: /(sourceCodeUrl:.*?\/tree\/)(master)(\/packages[^\n]*)/,
find: /(sourceCodeUrl:.*?\/tree\/)(main)(\/packages[^\n]*)/,
replaceWith: `$1sdk-${sdk.substring(0, 2)}$3`,
},
]);
Expand Down
2 changes: 1 addition & 1 deletion tools/src/commands/PublishPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default (program: Command) => {
/* debug options */
.option(
'-S, --skip-repo-checks',
'Skips checking whether the command is run on master branch and there are no unstaged changes.',
'Skips checking whether the command is run on main branch and there are no unstaged changes.',
false
)
.option(
Expand Down
14 changes: 7 additions & 7 deletions tools/src/publish-packages/tasks/checkRepositoryStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,24 @@ export const checkRepositoryStatus = new Task<TaskArgs>(
);

/**
* Checks whether the command is run on master branch or package side-branch.
* Checks whether the command is run on main branch or package side-branch.
* Otherwise, it prompts to confirm that you know what you're doing.
* On CI it returns `true` only if run on `master` branch.
* On CI it returns `true` only if run on `main` branch.
*/
async function checkBranchNameAsync(branchName: string) {
if (process.env.CI) {
// CI is allowed to publish only from master.
return branchName === 'master';
// CI is allowed to publish only from main.
return branchName === 'main';
}

// Publishes can be run on `master` or package's side-branches like `expo-package/1.x.x`
if (branchName === 'master' || /^[\w\-@]+\/\d+\.(x\.x|\d+\.x)$/.test(branchName)) {
// Publishes can be run on `main` or package's side-branches like `expo-package/1.x.x`
if (branchName === 'main' || /^[\w\-@]+\/\d+\.(x\.x|\d+\.x)$/.test(branchName)) {
return true;
}

logger.warn(
'⚠️ ',
`It's recommended to publish from ${blue('master')} branch, while you're at ${blue(branchName)}`
`It's recommended to publish from ${blue('main')} branch, while you're at ${blue(branchName)}`
);

const { confirmed } = await inquirer.prompt<{ confirmed: boolean }>([
Expand Down
6 changes: 3 additions & 3 deletions tools/src/publish-packages/tasks/commentOnIssuesTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export const commentOnIssuesTask = new Task<TaskArgs>(
const currentBranchName = await Git.getCurrentBranchNameAsync();

// Sometimes we publish from different branches (especially for testing) where comments are not advisable.
if (currentBranchName !== 'master') {
logger.warn('This feature is disabled on branches other than master');
if (currentBranchName !== 'main') {
logger.warn('This feature is disabled on branches other than main');
logManualFallback(payload);
return;
}
Expand Down Expand Up @@ -195,5 +195,5 @@ function linkToNpmPackage(packageName: string, version: string): string {
*/
function linkToChangelog(pkg: Package): string {
const changelogRelativePath = path.relative(EXPO_DIR, pkg.changelogPath);
return `[CHANGELOG.md](https://github.com/expo/expo/blob/master/${changelogRelativePath})`;
return `[CHANGELOG.md](https://github.com/expo/expo/blob/main/${changelogRelativePath})`;
}

0 comments on commit 168ee43

Please sign in to comment.