mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-15 13:51:20 +00:00
feat(supported-version): add user-defined kind (#28)
`kind` is a new input property for the `supported-version` action which allows one to define what specific versions of Magento they support. Currently, `kind` supports `latest`, `currently-supported`, and `custom`. See the README for `supported-version` if you want more specifics
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { GithubActionsMatrix, MagentoMatrixVersion } from "./matrix-type";
|
||||
import compositeVersionJson from '../versions/composite.json';
|
||||
import individualVersionJson from '../versions/individual.json';
|
||||
|
||||
const knownVersions : Record<string, MagentoMatrixVersion> = {...individualVersionJson, ...compositeVersionJson };
|
||||
|
||||
/**
|
||||
* Computes the Github Actions Matrix for given versions of Magento
|
||||
*/
|
||||
export const getMatrixForVersions = (versions: string[]): GithubActionsMatrix => {
|
||||
return versions.reduce((acc, current): GithubActionsMatrix => {
|
||||
if(knownVersions[current] === undefined){
|
||||
throw new Error("Unknown version while computing matrix");
|
||||
}
|
||||
|
||||
return {
|
||||
magento: [...acc.magento, current],
|
||||
include: [...acc.include, knownVersions[current]]
|
||||
}
|
||||
}, {magento: [], include: []});
|
||||
}
|
||||
Reference in New Issue
Block a user