From 671fc9a635ceb98715aa869d6172317da7bb3b33 Mon Sep 17 00:00:00 2001 From: aparna-ravindra Date: Mon, 23 Aug 2021 11:00:59 +0530 Subject: [PATCH 1/4] deployment as a category in properties.json --- ci/properties/alibabacloud.properties.json | 2 +- ci/properties/aws.properties.json | 2 +- ci/properties/azure.properties.json | 2 +- ci/properties/google.properties.json | 2 +- ci/properties/ibm.properties.json | 2 +- ci/properties/openshift.properties.json | 2 +- ci/properties/tencent.properties.json | 2 +- ci/properties/terraform.properties.json | 2 +- script/sync-ghes/index.ts | 15 +++++++++------ script/sync-ghes/settings.json | 10 ++++++++++ 10 files changed, 27 insertions(+), 14 deletions(-) diff --git a/ci/properties/alibabacloud.properties.json b/ci/properties/alibabacloud.properties.json index bbee6df..f1e33f2 100644 --- a/ci/properties/alibabacloud.properties.json +++ b/ci/properties/alibabacloud.properties.json @@ -3,5 +3,5 @@ "description": "Deploy a container to Alibaba Cloud Container Service for Kubernetes (ACK).", "creator": "Alibaba Cloud", "iconName": "alibabacloud", - "categories": null + "categories": ["deployment"] } diff --git a/ci/properties/aws.properties.json b/ci/properties/aws.properties.json index b80775f..33c3064 100644 --- a/ci/properties/aws.properties.json +++ b/ci/properties/aws.properties.json @@ -3,5 +3,5 @@ "description": "Deploy a container to an Amazon ECS service powered by AWS Fargate or Amazon EC2.", "creator": "Amazon Web Services", "iconName": "aws", - "categories": null + "categories": ["deployment"] } \ No newline at end of file diff --git a/ci/properties/azure.properties.json b/ci/properties/azure.properties.json index fd9d0d8..4970936 100644 --- a/ci/properties/azure.properties.json +++ b/ci/properties/azure.properties.json @@ -3,5 +3,5 @@ "description": "Build a Node.js project and deploy it to an Azure Web App.", "creator": "Microsoft Azure", "iconName": "azure", - "categories": null + "categories": ["deployment"] } \ No newline at end of file diff --git a/ci/properties/google.properties.json b/ci/properties/google.properties.json index e2d917d..ed69c5e 100644 --- a/ci/properties/google.properties.json +++ b/ci/properties/google.properties.json @@ -3,5 +3,5 @@ "description": "Build a docker container, publish it to Google Container Registry, and deploy to GKE.", "creator": "Google Cloud", "iconName": "googlegke", - "categories": null + "categories": ["deployment"] } \ No newline at end of file diff --git a/ci/properties/ibm.properties.json b/ci/properties/ibm.properties.json index cfd0383..0c1efdc 100644 --- a/ci/properties/ibm.properties.json +++ b/ci/properties/ibm.properties.json @@ -3,5 +3,5 @@ "description": "Build a docker container, publish it to IBM Cloud Container Registry, and deploy to IBM Cloud Kubernetes Service.", "creator": "IBM", "iconName": "ibm", - "categories": null + "categories": ["deployment"] } \ No newline at end of file diff --git a/ci/properties/openshift.properties.json b/ci/properties/openshift.properties.json index 53538c7..d500aa9 100644 --- a/ci/properties/openshift.properties.json +++ b/ci/properties/openshift.properties.json @@ -3,5 +3,5 @@ "description": "Build a Docker-based project and deploy it to OpenShift.", "creator": "Red Hat", "iconName": "openshift", - "categories": [ "Dockerfile" ] + "categories": [ "deployment", "Dockerfile" ] } diff --git a/ci/properties/tencent.properties.json b/ci/properties/tencent.properties.json index ba579a1..465073e 100644 --- a/ci/properties/tencent.properties.json +++ b/ci/properties/tencent.properties.json @@ -3,5 +3,5 @@ "description": "This workflow will build a docker container, publish and deploy it to Tencent Kubernetes Engine (TKE).", "creator": "Tencent Cloud", "iconName": "tencentcloud", - "categories": null + "categories": ["deployment"] } \ No newline at end of file diff --git a/ci/properties/terraform.properties.json b/ci/properties/terraform.properties.json index bfeabdf..9929d33 100644 --- a/ci/properties/terraform.properties.json +++ b/ci/properties/terraform.properties.json @@ -3,5 +3,5 @@ "description": "Set up Terraform CLI in your GitHub Actions workflow.", "creator": "HashiCorp", "iconName": "terraform", - "categories": null + "categories": ["deployment"] } diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index 0fa3440..ea67432 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -19,6 +19,8 @@ interface WorkflowProperties { iconName?: string; categories: string[] | null; + + creator?: string; } interface WorkflowsCheckResult { @@ -28,12 +30,14 @@ interface WorkflowsCheckResult { async function checkWorkflows( folders: string[], - enabledActions: string[] + enabledActions: string[], + partners: string[] ): Promise { const result: WorkflowsCheckResult = { compatibleWorkflows: [], incompatibleWorkflows: [], }; + const partnersSet = new Set(partners.map((x) => x.toLowerCase())); for (const folder of folders) { const dir = await fs.readdir(folder, { @@ -51,11 +55,10 @@ async function checkWorkflows( )); const iconName: string | undefined = workflowProperties["iconName"]; - const isBlankTemplate = workflowId === "blank"; - const partnerWorkflow = workflowProperties.categories === null; + const partnerWorkflow = workflowProperties.creator ? partnersSet.has(workflowProperties.creator.toLowerCase()) : false; const enabled = - (isBlankTemplate || !partnerWorkflow) && + !partnerWorkflow && (await checkWorkflow(workflowFilePath, enabledActions)); const workflowDesc: WorkflowDesc = { @@ -90,7 +93,6 @@ async function checkWorkflow( ): Promise { // Create set with lowercase action names for easier, case-insensitive lookup const enabledActionsSet = new Set(enabledActions.map((x) => x.toLowerCase())); - try { const workflowFileContent = await fs.readFile(workflowPath, "utf8"); const workflow = safeLoad(workflowFileContent); @@ -126,7 +128,8 @@ async function checkWorkflow( const result = await checkWorkflows( settings.folders, - settings.enabledActions + settings.enabledActions, + settings.partners ); console.group( diff --git a/script/sync-ghes/settings.json b/script/sync-ghes/settings.json index 050ea0a..60b70ed 100644 --- a/script/sync-ghes/settings.json +++ b/script/sync-ghes/settings.json @@ -16,5 +16,15 @@ "actions/starter-workflows", "actions/upload-artifact", "actions/upload-release-asset" + ], + "partners": [ + "Alibaba Cloud", + "Amazon Web Services", + "Microsoft Azure", + "Google Cloud", + "IBM", + "Red Hat", + "Tencent Cloud", + "HashiCorp" ] } From b2ac199660644065c2468dbf53cf85811f6d07de Mon Sep 17 00:00:00 2001 From: aparna-ravindra Date: Mon, 23 Aug 2021 11:08:57 +0530 Subject: [PATCH 2/4] reordering categories --- ci/properties/openshift.properties.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/properties/openshift.properties.json b/ci/properties/openshift.properties.json index d500aa9..1bc2eca 100644 --- a/ci/properties/openshift.properties.json +++ b/ci/properties/openshift.properties.json @@ -3,5 +3,5 @@ "description": "Build a Docker-based project and deploy it to OpenShift.", "creator": "Red Hat", "iconName": "openshift", - "categories": [ "deployment", "Dockerfile" ] + "categories": ["Dockerfile","deployment" ] } From f5724905e59be4fea1e9005c20734660e07c36fe Mon Sep 17 00:00:00 2001 From: aparna-ravindra Date: Mon, 23 Aug 2021 12:47:22 +0530 Subject: [PATCH 3/4] capitalizing category --- ci/properties/alibabacloud.properties.json | 2 +- ci/properties/aws.properties.json | 2 +- ci/properties/azure.properties.json | 2 +- ci/properties/google.properties.json | 2 +- ci/properties/ibm.properties.json | 2 +- ci/properties/openshift.properties.json | 2 +- ci/properties/tencent.properties.json | 2 +- ci/properties/terraform.properties.json | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ci/properties/alibabacloud.properties.json b/ci/properties/alibabacloud.properties.json index f1e33f2..1ce285f 100644 --- a/ci/properties/alibabacloud.properties.json +++ b/ci/properties/alibabacloud.properties.json @@ -3,5 +3,5 @@ "description": "Deploy a container to Alibaba Cloud Container Service for Kubernetes (ACK).", "creator": "Alibaba Cloud", "iconName": "alibabacloud", - "categories": ["deployment"] + "categories": ["Deployment"] } diff --git a/ci/properties/aws.properties.json b/ci/properties/aws.properties.json index 33c3064..10a7ed3 100644 --- a/ci/properties/aws.properties.json +++ b/ci/properties/aws.properties.json @@ -3,5 +3,5 @@ "description": "Deploy a container to an Amazon ECS service powered by AWS Fargate or Amazon EC2.", "creator": "Amazon Web Services", "iconName": "aws", - "categories": ["deployment"] + "categories": ["Deployment"] } \ No newline at end of file diff --git a/ci/properties/azure.properties.json b/ci/properties/azure.properties.json index 4970936..362d5d1 100644 --- a/ci/properties/azure.properties.json +++ b/ci/properties/azure.properties.json @@ -3,5 +3,5 @@ "description": "Build a Node.js project and deploy it to an Azure Web App.", "creator": "Microsoft Azure", "iconName": "azure", - "categories": ["deployment"] + "categories": ["Deployment"] } \ No newline at end of file diff --git a/ci/properties/google.properties.json b/ci/properties/google.properties.json index ed69c5e..c7f216f 100644 --- a/ci/properties/google.properties.json +++ b/ci/properties/google.properties.json @@ -3,5 +3,5 @@ "description": "Build a docker container, publish it to Google Container Registry, and deploy to GKE.", "creator": "Google Cloud", "iconName": "googlegke", - "categories": ["deployment"] + "categories": ["Deployment"] } \ No newline at end of file diff --git a/ci/properties/ibm.properties.json b/ci/properties/ibm.properties.json index 0c1efdc..4219690 100644 --- a/ci/properties/ibm.properties.json +++ b/ci/properties/ibm.properties.json @@ -3,5 +3,5 @@ "description": "Build a docker container, publish it to IBM Cloud Container Registry, and deploy to IBM Cloud Kubernetes Service.", "creator": "IBM", "iconName": "ibm", - "categories": ["deployment"] + "categories": ["Deployment"] } \ No newline at end of file diff --git a/ci/properties/openshift.properties.json b/ci/properties/openshift.properties.json index 1bc2eca..54948c2 100644 --- a/ci/properties/openshift.properties.json +++ b/ci/properties/openshift.properties.json @@ -3,5 +3,5 @@ "description": "Build a Docker-based project and deploy it to OpenShift.", "creator": "Red Hat", "iconName": "openshift", - "categories": ["Dockerfile","deployment" ] + "categories": ["Dockerfile","Deployment" ] } diff --git a/ci/properties/tencent.properties.json b/ci/properties/tencent.properties.json index 465073e..32d0da7 100644 --- a/ci/properties/tencent.properties.json +++ b/ci/properties/tencent.properties.json @@ -3,5 +3,5 @@ "description": "This workflow will build a docker container, publish and deploy it to Tencent Kubernetes Engine (TKE).", "creator": "Tencent Cloud", "iconName": "tencentcloud", - "categories": ["deployment"] + "categories": ["Deployment"] } \ No newline at end of file diff --git a/ci/properties/terraform.properties.json b/ci/properties/terraform.properties.json index 9929d33..12afabe 100644 --- a/ci/properties/terraform.properties.json +++ b/ci/properties/terraform.properties.json @@ -3,5 +3,5 @@ "description": "Set up Terraform CLI in your GitHub Actions workflow.", "creator": "HashiCorp", "iconName": "terraform", - "categories": ["deployment"] + "categories": ["Deployment"] } From e56cb5c21591a7ad820f6c22de2e7d212ead898b Mon Sep 17 00:00:00 2001 From: aparna-ravindra Date: Tue, 24 Aug 2021 10:28:09 +0530 Subject: [PATCH 4/4] renaming variable --- script/sync-ghes/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index ea67432..e37eca3 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -55,10 +55,10 @@ async function checkWorkflows( )); const iconName: string | undefined = workflowProperties["iconName"]; - const partnerWorkflow = workflowProperties.creator ? partnersSet.has(workflowProperties.creator.toLowerCase()) : false; + const isPartnerWorkflow = workflowProperties.creator ? partnersSet.has(workflowProperties.creator.toLowerCase()) : false; const enabled = - !partnerWorkflow && + !isPartnerWorkflow && (await checkWorkflow(workflowFilePath, enabledActions)); const workflowDesc: WorkflowDesc = {