mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-13 13:14:53 +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,11 @@
|
||||
import { isValidKind } from "./compute-kind";
|
||||
|
||||
describe('isValidKind', () => {
|
||||
it('returns `true` if its a valid kind', () => {
|
||||
expect(isValidKind("latest")).toBe(true);
|
||||
});
|
||||
|
||||
it('returns `false` if it is not a valid kind', () => {
|
||||
expect(isValidKind("taco")).toBe(false);
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Acceptable arguments for version `kind`
|
||||
*/
|
||||
export const KNOWN_KINDS = {
|
||||
'currently-supported': true,
|
||||
'latest': true,
|
||||
'custom': true,
|
||||
}
|
||||
|
||||
export const isValidKind = (kind: string): boolean => {
|
||||
return kind in KNOWN_KINDS;
|
||||
};
|
||||
|
||||
export const validateOrError = (kind: string): true => {
|
||||
if(isValidKind(kind)){
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Invalid kind provided, supported kinds are: ${Object.keys(KNOWN_KINDS).join(', ')}`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
[
|
||||
"magento/project-community-edition:>=2.3 <2.4",
|
||||
"magento/project-community-edition:>=2.4.0 <2.4.1",
|
||||
"magento/project-community-edition:>=2.4.1 <2.4.2",
|
||||
"magento/project-community-edition:>=2.4.2 <2.4.3",
|
||||
"magento/project-community-edition:>=2.4.3 <2.4.4",
|
||||
"magento/project-community-edition:>=2.4.4 <2.4.5",
|
||||
"magento/project-community-edition"
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"magento/project-community-edition"
|
||||
]
|
||||
Reference in New Issue
Block a user