Skip to content

Commit 197c327

Browse files
authored
build: [12.x] preparation for primary branch rename in the Angular repos (#24791)
Preparation for the components repo as outlined our planning document.
1 parent cab054a commit 197c327

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

.circleci/config.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ var_13: &attach_release_output
8282
var_14: &publish_branches_filter
8383
branches:
8484
only:
85+
- main
86+
# TODO(BRANCH_RENAME_CLEANUP): remove
8587
- master
8688
# 6.0.x, 7.1.x, etc.
8789
- /\d+\.\d+\.x/
@@ -134,8 +136,10 @@ var_20: &slack_notify_on_failure
134136
# Branch filter that only matches the main branch.
135137
var_21: &only_main_branch_filter
136138
branches:
137-
only:
138-
- master
139+
only:
140+
- main
141+
# TODO(BRANCH_RENAME_CLEANUP): remove
142+
- master
139143

140144
# -----------------------------
141145
# Container version of CircleCI
@@ -715,7 +719,9 @@ workflows:
715719
filters:
716720
branches:
717721
only:
718-
# We only want to run the "master" branch against the snapshot builds because
722+
# We only want to run the main branch against the snapshot builds because
719723
# it's not guaranteed that older versions of Angular Material always work
720724
# with the latest Angular version.
725+
- main
726+
# TODO(BRANCH_RENAME_CLEANUP): remove
721727
- master

.circleci/rebase-pr.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,31 @@ async function _main() {
9595
/**
9696
* Sort a list of fullpath refs into a list and then provide the first entry.
9797
*
98-
* The sort order will first find master ref, and then any semver ref, followed
98+
* The sort order will first find main branch, and then any semver ref, followed
9999
* by the rest of the refs in the order provided.
100100
*
101-
* Branches are sorted in this order as work is primarily done on master, and
102-
* otherwise on a semver branch. If neither of those were to match, the most
101+
* Branches are sorted in this order as work is primarily done on main branches,
102+
* and otherwise on a semver branch. If neither of those were to match, the most
103103
* likely correct branch will be the first one encountered in the list.
104104
*/
105105
function getRefFromBranchList(gitOutput) {
106106
const branches = gitOutput.split('\n').map(b => b.split('/').slice(1).join('').trim());
107107
return branches.sort((a, b) => {
108+
if (a === 'main') {
109+
return -1;
110+
}
111+
if (b === 'main') {
112+
return 1;
113+
}
114+
115+
// TODO(BRANCH_RENAME_CLEANUP): remove
108116
if (a === 'master') {
109117
return -1;
110118
}
111119
if (b === 'master') {
112120
return 1;
113121
}
122+
114123
const aIsSemver = semverRegex.test(a);
115124
const bIsSemver = semverRegex.test(b);
116125
if (aIsSemver && bIsSemver) {

0 commit comments

Comments
 (0)