Files
github-actions-magento2/supported-version/src/nightly/amend-matrix-for-next.ts
T
2023-09-24 16:07:37 -04:00

23 lines
1011 B
TypeScript

import { GithubActionsMatrix } from "../matrix/matrix-type";
import { Repository } from "./repository";
import { unifyNextPackageName } from "./unify-next-package-name";
/**
* A placeholder value use to refer to the next version of Magento.
* This value is just a placeholder, there is no "next" version (as of authoring).
*/
export const nextVersionPlaceHolder = "next";
export const amendMatrixForNext = (matrix: GithubActionsMatrix, repository: Repository, date: Date = new Date()): GithubActionsMatrix => {
const nextVersionRegExp = new RegExp(nextVersionPlaceHolder + '$');
matrix.magento = matrix.magento.map((item) => item.match(nextVersionRegExp) ? unifyNextPackageName(item, repository, date) : item);
matrix.include = matrix.include.map((item) => {
return item.magento.match(nextVersionRegExp)
? {
...item,
magento: unifyNextPackageName(item.magento, repository, date),
}
: item;
});
return matrix;
}