mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-13 13:14:53 +00:00
23 lines
1011 B
TypeScript
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;
|
|
} |