Merge pull request #1058 from aparna-ravindra/deployment_as_a_category

"deployment" as a category in properties.json
This commit is contained in:
Ashwin Sangem
2021-08-25 09:49:12 +05:30
committed by GitHub
10 changed files with 27 additions and 14 deletions
+1 -1
View File
@@ -3,5 +3,5 @@
"description": "Deploy a container to Alibaba Cloud Container Service for Kubernetes (ACK).", "description": "Deploy a container to Alibaba Cloud Container Service for Kubernetes (ACK).",
"creator": "Alibaba Cloud", "creator": "Alibaba Cloud",
"iconName": "alibabacloud", "iconName": "alibabacloud",
"categories": null "categories": ["Deployment"]
} }
+1 -1
View File
@@ -3,5 +3,5 @@
"description": "Deploy a container to an Amazon ECS service powered by AWS Fargate or Amazon EC2.", "description": "Deploy a container to an Amazon ECS service powered by AWS Fargate or Amazon EC2.",
"creator": "Amazon Web Services", "creator": "Amazon Web Services",
"iconName": "aws", "iconName": "aws",
"categories": null "categories": ["Deployment"]
} }
+1 -1
View File
@@ -3,5 +3,5 @@
"description": "Build a Node.js project and deploy it to an Azure Web App.", "description": "Build a Node.js project and deploy it to an Azure Web App.",
"creator": "Microsoft Azure", "creator": "Microsoft Azure",
"iconName": "azure", "iconName": "azure",
"categories": null "categories": ["Deployment"]
} }
+1 -1
View File
@@ -3,5 +3,5 @@
"description": "Build a docker container, publish it to Google Container Registry, and deploy to GKE.", "description": "Build a docker container, publish it to Google Container Registry, and deploy to GKE.",
"creator": "Google Cloud", "creator": "Google Cloud",
"iconName": "googlegke", "iconName": "googlegke",
"categories": null "categories": ["Deployment"]
} }
+1 -1
View File
@@ -3,5 +3,5 @@
"description": "Build a docker container, publish it to IBM Cloud Container Registry, and deploy to IBM Cloud Kubernetes Service.", "description": "Build a docker container, publish it to IBM Cloud Container Registry, and deploy to IBM Cloud Kubernetes Service.",
"creator": "IBM", "creator": "IBM",
"iconName": "ibm", "iconName": "ibm",
"categories": null "categories": ["Deployment"]
} }
+1 -1
View File
@@ -3,5 +3,5 @@
"description": "Build a Docker-based project and deploy it to OpenShift.", "description": "Build a Docker-based project and deploy it to OpenShift.",
"creator": "Red Hat", "creator": "Red Hat",
"iconName": "openshift", "iconName": "openshift",
"categories": [ "Dockerfile" ] "categories": ["Dockerfile","Deployment" ]
} }
+1 -1
View File
@@ -3,5 +3,5 @@
"description": "This workflow will build a docker container, publish and deploy it to Tencent Kubernetes Engine (TKE).", "description": "This workflow will build a docker container, publish and deploy it to Tencent Kubernetes Engine (TKE).",
"creator": "Tencent Cloud", "creator": "Tencent Cloud",
"iconName": "tencentcloud", "iconName": "tencentcloud",
"categories": null "categories": ["Deployment"]
} }
+1 -1
View File
@@ -3,5 +3,5 @@
"description": "Set up Terraform CLI in your GitHub Actions workflow.", "description": "Set up Terraform CLI in your GitHub Actions workflow.",
"creator": "HashiCorp", "creator": "HashiCorp",
"iconName": "terraform", "iconName": "terraform",
"categories": null "categories": ["Deployment"]
} }
+9 -6
View File
@@ -19,6 +19,8 @@ interface WorkflowProperties {
iconName?: string; iconName?: string;
categories: string[] | null; categories: string[] | null;
creator?: string;
} }
interface WorkflowsCheckResult { interface WorkflowsCheckResult {
@@ -28,12 +30,14 @@ interface WorkflowsCheckResult {
async function checkWorkflows( async function checkWorkflows(
folders: string[], folders: string[],
enabledActions: string[] enabledActions: string[],
partners: string[]
): Promise<WorkflowsCheckResult> { ): Promise<WorkflowsCheckResult> {
const result: WorkflowsCheckResult = { const result: WorkflowsCheckResult = {
compatibleWorkflows: [], compatibleWorkflows: [],
incompatibleWorkflows: [], incompatibleWorkflows: [],
}; };
const partnersSet = new Set(partners.map((x) => x.toLowerCase()));
for (const folder of folders) { for (const folder of folders) {
const dir = await fs.readdir(folder, { const dir = await fs.readdir(folder, {
@@ -51,11 +55,10 @@ async function checkWorkflows(
)); ));
const iconName: string | undefined = workflowProperties["iconName"]; const iconName: string | undefined = workflowProperties["iconName"];
const isBlankTemplate = workflowId === "blank"; const isPartnerWorkflow = workflowProperties.creator ? partnersSet.has(workflowProperties.creator.toLowerCase()) : false;
const partnerWorkflow = workflowProperties.categories === null;
const enabled = const enabled =
(isBlankTemplate || !partnerWorkflow) && !isPartnerWorkflow &&
(await checkWorkflow(workflowFilePath, enabledActions)); (await checkWorkflow(workflowFilePath, enabledActions));
const workflowDesc: WorkflowDesc = { const workflowDesc: WorkflowDesc = {
@@ -90,7 +93,6 @@ async function checkWorkflow(
): Promise<boolean> { ): Promise<boolean> {
// Create set with lowercase action names for easier, case-insensitive lookup // Create set with lowercase action names for easier, case-insensitive lookup
const enabledActionsSet = new Set(enabledActions.map((x) => x.toLowerCase())); const enabledActionsSet = new Set(enabledActions.map((x) => x.toLowerCase()));
try { try {
const workflowFileContent = await fs.readFile(workflowPath, "utf8"); const workflowFileContent = await fs.readFile(workflowPath, "utf8");
const workflow = safeLoad(workflowFileContent); const workflow = safeLoad(workflowFileContent);
@@ -126,7 +128,8 @@ async function checkWorkflow(
const result = await checkWorkflows( const result = await checkWorkflows(
settings.folders, settings.folders,
settings.enabledActions settings.enabledActions,
settings.partners
); );
console.group( console.group(
+10
View File
@@ -16,5 +16,15 @@
"actions/starter-workflows", "actions/starter-workflows",
"actions/upload-artifact", "actions/upload-artifact",
"actions/upload-release-asset" "actions/upload-release-asset"
],
"partners": [
"Alibaba Cloud",
"Amazon Web Services",
"Microsoft Azure",
"Google Cloud",
"IBM",
"Red Hat",
"Tencent Cloud",
"HashiCorp"
] ]
} }