Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ng-dev/release/publish/actions/renovate-config-updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {targetLabels} from '../../../pr/common/labels/target.js';
* @param projectDir - The path to the project directory.
* @param newBranchName - The name of the new branch to add to the base branches list.
* @returns A promise that resolves to the path of the modified `renovate.json` file if updated,
* or `null` if the file was not found or the `baseBranches` array has an unexpected format.
* or `null` if the file was not found or the `baseBranchPatterns` array has an unexpected format.
*/
export async function updateRenovateConfig(
projectDir: string,
Expand All @@ -25,17 +25,17 @@ export async function updateRenovateConfig(

const config = await readFile(renovateConfigPath, 'utf-8');
const configJson = JSON.parse(config) as Record<string, unknown>;
const baseBranches = configJson['baseBranches'];
const baseBranchPatterns = configJson['baseBranchPatterns'];

if (!Array.isArray(baseBranches) || baseBranches.length !== 2) {
if (!Array.isArray(baseBranchPatterns) || baseBranchPatterns.length !== 2) {
Log.warn(
` ✘ Skipped updating Renovate config: "baseBranches" must contain exactly 2 branches.`,
` ✘ Skipped updating Renovate config: "baseBranchPatterns" must contain exactly 2 branches.`,
);

return null;
}

configJson['baseBranches'] = ['main', newBranchName];
configJson['baseBranchPatterns'] = ['main', newBranchName];

updateRenovateTargetLabel(
configJson,
Expand All @@ -56,7 +56,7 @@ export async function updateRenovateConfig(
* @param fromLabel - The label name to be replaced.
* @param toLabel - The new label name to replace `fromLabel` with.
* @returns A promise that resolves to the path of the modified `renovate.json` file if updated,
* or `null` if the file was not found or the `baseBranches` array has an unexpected format.
* or `null` if the file was not found or the `baseBranchPatterns` array has an unexpected format.
*/
export async function updateRenovateConfigTargetLabels(
projectDir: string,
Expand All @@ -73,11 +73,11 @@ export async function updateRenovateConfigTargetLabels(
const config = await readFile(renovateConfigPath, 'utf-8');
const configJson = JSON.parse(config) as Record<string, unknown>;

// Check baseBranches just in case, though this function's primary focus is labels
const baseBranches = configJson['baseBranches'];
if (!Array.isArray(baseBranches) || baseBranches.length !== 2) {
// Check baseBranchPatterns just in case, though this function's primary focus is labels
const baseBranchPatterns = configJson['baseBranchPatterns'];
if (!Array.isArray(baseBranchPatterns) || baseBranchPatterns.length !== 2) {
Log.warn(
` ✘ Skipped updating Renovate config: "baseBranches" must contain exactly 2 branches.`,
` ✘ Skipped updating Renovate config: "baseBranchPatterns" must contain exactly 2 branches.`,
);

return null;
Expand Down
2 changes: 1 addition & 1 deletion ng-dev/release/publish/test/common.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ describe('common release action logic', () => {
writeFileSync(
renovateConfigPath,
JSON.stringify({
'baseBranches': ['main', '20.1.x'],
'baseBranchPatterns': ['main', '20.1.x'],
'packageRules': [
{
'matchBaseBranches': ['main'],
Expand Down