From 88d425bbe7b0a404065b83ddf3c08ae3b2d4581d Mon Sep 17 00:00:00 2001 From: Christopher Schleiden Date: Wed, 20 May 2020 10:40:26 -0700 Subject: [PATCH] Sync icons only for supported workflows --- script/sync-ghes/index.ts | 14 +++++++++++++- script/sync-ghes/settings.json | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index c5633c2..b63c124 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -7,6 +7,7 @@ import { exec } from "./exec"; interface WorkflowDesc { folder: string; id: string; + iconName: string; } interface WorkflowsCheckResult { @@ -33,9 +34,18 @@ async function checkWorkflows( const workflowFilePath = join(folder, e.name); const enabled = await checkWorkflow(workflowFilePath, enabledActions); + const workflowId = basename(e.name, extname(e.name)); + const workflowProperties = require(join( + folder, + "properties", + `${workflowId}.properties.json` + )); + const iconName = workflowProperties["iconName"]; + const workflowDesc: WorkflowDesc = { folder, - id: basename(e.name, extname(e.name)), + id: workflowId, + iconName, }; if (!enabled) { @@ -126,6 +136,7 @@ async function checkWorkflow( // whether it's a deletion, add, or modify and commit the new state. console.log("Remove all workflows"); await exec("rm", ["-fr", ...settings.folders]); + await exec("rm", ["-fr", "../../icons"]); console.log("Sync changes from master for compatible workflows"); await exec("git", [ @@ -137,6 +148,7 @@ async function checkWorkflow( result.compatibleWorkflows.map((x) => [ join(x.folder, `${x.id}.yml`), join(x.folder, "properties", `${x.id}.properties.json`), + join("../../icons", `${x.iconName}.svg`), ]) ), ]); diff --git a/script/sync-ghes/settings.json b/script/sync-ghes/settings.json index 977c6f5..050ea0a 100644 --- a/script/sync-ghes/settings.json +++ b/script/sync-ghes/settings.json @@ -1,7 +1,7 @@ { "folders": [ - "../ci", - "../automation" + "../../ci", + "../../automation" ], "enabledActions": [ "actions/checkout",