From 7e9ab60c5f227c12ce1b4197e7bc9ef4447d2e18 Mon Sep 17 00:00:00 2001 From: Fabian Aguilar Gomez Date: Fri, 19 Apr 2024 16:26:10 -0500 Subject: [PATCH 01/17] remove pages for now --- script/sync-ghes/settings.json | 1 - 1 file changed, 1 deletion(-) diff --git a/script/sync-ghes/settings.json b/script/sync-ghes/settings.json index 41d6bcdfc4..c848615b01 100644 --- a/script/sync-ghes/settings.json +++ b/script/sync-ghes/settings.json @@ -3,7 +3,6 @@ "../../ci", "../../automation", "../../code-scanning", - "../../pages" ], "enabledActions": [ "actions/cache", From 29b0a3e3a9e362bf782a2d3d4bd200a92b577704 Mon Sep 17 00:00:00 2001 From: Fabian Aguilar Gomez Date: Fri, 19 Apr 2024 16:30:57 -0500 Subject: [PATCH 02/17] Update settings.json --- script/sync-ghes/settings.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/script/sync-ghes/settings.json b/script/sync-ghes/settings.json index c848615b01..0fd7319433 100644 --- a/script/sync-ghes/settings.json +++ b/script/sync-ghes/settings.json @@ -10,7 +10,6 @@ "actions/configure-pages", "actions/create-release", "actions/delete-package-versions", - "actions/deploy-pages", "actions/download-artifact", "actions/jekyll-build-pages", "actions/setup-dotnet", @@ -21,7 +20,6 @@ "actions/stale", "actions/starter-workflows", "actions/upload-artifact", - "actions/upload-pages-artifact", "actions/upload-release-asset", "github/codeql-action" ], From 5902ad751bbf5a50ae17fe754e01046512540412 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 11:56:18 -0700 Subject: [PATCH 03/17] Update script/sync-ghes/settings.json --- script/sync-ghes/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/sync-ghes/settings.json b/script/sync-ghes/settings.json index 0fd7319433..0dbea1e647 100644 --- a/script/sync-ghes/settings.json +++ b/script/sync-ghes/settings.json @@ -2,7 +2,7 @@ "folders": [ "../../ci", "../../automation", - "../../code-scanning", + "../../code-scanning" ], "enabledActions": [ "actions/cache", From d526113a1b61be86f4ba9aac4f765073a26cdd65 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 11:56:46 -0700 Subject: [PATCH 04/17] Update script/sync-ghes/settings.json --- script/sync-ghes/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/script/sync-ghes/settings.json b/script/sync-ghes/settings.json index 0dbea1e647..fec0264068 100644 --- a/script/sync-ghes/settings.json +++ b/script/sync-ghes/settings.json @@ -10,6 +10,7 @@ "actions/configure-pages", "actions/create-release", "actions/delete-package-versions", + "actions/deploy-pages", "actions/download-artifact", "actions/jekyll-build-pages", "actions/setup-dotnet", From 7d07997513aa76f3d0f2523a58b194c1c1b90b6d Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 11:57:05 -0700 Subject: [PATCH 05/17] Update script/sync-ghes/settings.json --- script/sync-ghes/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/script/sync-ghes/settings.json b/script/sync-ghes/settings.json index fec0264068..cb0197aa44 100644 --- a/script/sync-ghes/settings.json +++ b/script/sync-ghes/settings.json @@ -21,6 +21,7 @@ "actions/stale", "actions/starter-workflows", "actions/upload-artifact", + "actions/upload-pages-artifact", "actions/upload-release-asset", "github/codeql-action" ], From 264962401da5f1837581d623fbc211c84118ae07 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:03:21 -0700 Subject: [PATCH 06/17] ici --- script/sync-ghes/index.ts | 6 ++++++ script/sync-ghes/settings.json | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index f53d220b40..2559b40aa3 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -163,6 +163,9 @@ async function checkWorkflow( await exec("rm", ["-fr", ...settings.folders]); await exec("rm", ["-fr", "../../icons"]); + // Ignore read-only folders from compatible workflows list + result.compatibleWorkflows = result.compatibleWorkflows.filter(x => !settings.readOnlyFolders.includes(x.folder)); + console.log("Sync changes from main for compatible workflows"); await exec("git", [ "checkout", @@ -184,6 +187,9 @@ async function checkWorkflow( }) ), ]); + + // Add back Pages icons + } catch (e) { console.error("Unhandled error while syncing workflows", e); process.exitCode = 1; diff --git a/script/sync-ghes/settings.json b/script/sync-ghes/settings.json index cb0197aa44..ce18eb6179 100644 --- a/script/sync-ghes/settings.json +++ b/script/sync-ghes/settings.json @@ -2,7 +2,11 @@ "folders": [ "../../ci", "../../automation", - "../../code-scanning" + "../../code-scanning", + "../../pages" + ], + "readOnlyFolders": [ + "../../pages" ], "enabledActions": [ "actions/cache", From c7480532d0129274e25ccd09e2357377a228f56a Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:16:50 -0700 Subject: [PATCH 07/17] again --- 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 2559b40aa3..7c07a367ca 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -153,7 +153,7 @@ async function checkWorkflow( console.groupEnd(); console.log("Switch to GHES branch"); - await exec("git", ["checkout", "ghes"]); + // await exec("git", ["checkout", "ghes"]); // In order to sync from main, we might need to remove some workflows, add some // and modify others. The lazy approach is to delete all workflows first, and then @@ -163,7 +163,7 @@ async function checkWorkflow( await exec("rm", ["-fr", ...settings.folders]); await exec("rm", ["-fr", "../../icons"]); - // Ignore read-only folders from compatible workflows list + // Ignore compatible workflows in a read-only folder result.compatibleWorkflows = result.compatibleWorkflows.filter(x => !settings.readOnlyFolders.includes(x.folder)); console.log("Sync changes from main for compatible workflows"); From 252e935e86952db9cad9b0f6c9ee1d543f91e12c Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:17:24 -0700 Subject: [PATCH 08/17] ghes --- script/sync-ghes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index 7c07a367ca..e7cb2b2601 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -153,7 +153,7 @@ async function checkWorkflow( console.groupEnd(); console.log("Switch to GHES branch"); - // await exec("git", ["checkout", "ghes"]); + await exec("git", ["checkout", "ghes"]); // In order to sync from main, we might need to remove some workflows, add some // and modify others. The lazy approach is to delete all workflows first, and then From 1e15901e1c50134c3eb77f2b3c82b79d15a5f3e5 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:20:27 -0700 Subject: [PATCH 09/17] wip --- 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 e7cb2b2601..03d04f0779 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -156,11 +156,11 @@ async function checkWorkflow( await exec("git", ["checkout", "ghes"]); // In order to sync from main, we might need to remove some workflows, add some - // and modify others. The lazy approach is to delete all workflows first, and then + // and modify others. The lazy approach is to delete all workflows first (except from read-only folders), and then // just bring the compatible ones over from the main branch. We let git figure out // 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", ...(settings.folders.filter(x => !settings.readOnlyFolders.includes(x)))]); await exec("rm", ["-fr", "../../icons"]); // Ignore compatible workflows in a read-only folder From 138375ba29d0bac534217573f589a49ebb3d87d3 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:30:15 -0700 Subject: [PATCH 10/17] wip --- script/sync-ghes/index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index 03d04f0779..9105bb395b 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -160,11 +160,17 @@ async function checkWorkflow( // just bring the compatible ones over from the main branch. We let git figure out // whether it's a deletion, add, or modify and commit the new state. console.log("Remove all workflows"); - await exec("rm", ["-fr", ...(settings.folders.filter(x => !settings.readOnlyFolders.includes(x)))]); + await exec("rm", ["-fr", ...settings.folders]); await exec("rm", ["-fr", "../../icons"]); - // Ignore compatible workflows in a read-only folder - result.compatibleWorkflows = result.compatibleWorkflows.filter(x => !settings.readOnlyFolders.includes(x.folder)); + // Bring back the read-only folders + console.log("Restore read-only folders"); + settings.readOnlyFolders.forEach(async (folder) => { + await exec("git", [ + "checkout", + folder + ]); + }); console.log("Sync changes from main for compatible workflows"); await exec("git", [ From 66e7ed44ca7256287ab489b0eda374250e41979c Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:31:34 -0700 Subject: [PATCH 11/17] wip --- script/sync-ghes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index 9105bb395b..3b8aa93f73 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -165,7 +165,7 @@ async function checkWorkflow( // Bring back the read-only folders console.log("Restore read-only folders"); - settings.readOnlyFolders.forEach(async (folder) => { + await settings.readOnlyFolders.forEach(async (folder) => { await exec("git", [ "checkout", folder From ddca0a93277bce73784982a3a5e8ccb46f2bdac7 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:33:45 -0700 Subject: [PATCH 12/17] async --- script/sync-ghes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index 3b8aa93f73..9105bb395b 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -165,7 +165,7 @@ async function checkWorkflow( // Bring back the read-only folders console.log("Restore read-only folders"); - await settings.readOnlyFolders.forEach(async (folder) => { + settings.readOnlyFolders.forEach(async (folder) => { await exec("git", [ "checkout", folder From 3fa8d369daa66974da30d33cc5df57d08ac1cc1d Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:37:57 -0700 Subject: [PATCH 13/17] async --- script/sync-ghes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index 9105bb395b..3b8aa93f73 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -165,7 +165,7 @@ async function checkWorkflow( // Bring back the read-only folders console.log("Restore read-only folders"); - settings.readOnlyFolders.forEach(async (folder) => { + await settings.readOnlyFolders.forEach(async (folder) => { await exec("git", [ "checkout", folder From 9f6e4a9e7dbeddc1a36599c96b026a4e6afaf871 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:38:43 -0700 Subject: [PATCH 14/17] wip --- script/sync-ghes/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index 3b8aa93f73..0b84733cda 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -172,6 +172,8 @@ async function checkWorkflow( ]); }); + throw 'x' + console.log("Sync changes from main for compatible workflows"); await exec("git", [ "checkout", From 00731369055d2c5f848a5542fbbe453fc4b5761f Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:40:32 -0700 Subject: [PATCH 15/17] wip --- script/sync-ghes/index.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index 0b84733cda..2f20fec0b5 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -165,14 +165,12 @@ async function checkWorkflow( // Bring back the read-only folders console.log("Restore read-only folders"); - await settings.readOnlyFolders.forEach(async (folder) => { + for (let i = 0; i < settings.readOnlyFolders.length; i++) { await exec("git", [ "checkout", - folder + settings.readOnlyFolders[i] ]); - }); - - throw 'x' + } console.log("Sync changes from main for compatible workflows"); await exec("git", [ From dd92d3760d30c5eeaa21bbf35bfd83007e1e251b Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:43:22 -0700 Subject: [PATCH 16/17] wip --- script/sync-ghes/index.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index 2f20fec0b5..204294690d 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -180,10 +180,13 @@ async function checkWorkflow( ...Array.prototype.concat.apply( [], result.compatibleWorkflows.map((x) => { - const r = [ - join(x.folder, `${x.id}.yml`), - join(x.folder, "properties", `${x.id}.properties.json`), - ]; + const r = []; + + // Don't touch read-only folders + if (!settings.readOnlyFolders.includes(x.folder)) { + r.push(join(x.folder, `${x.id}.yml`)); + r.push(join(x.folder, "properties", `${x.id}.properties.json`)); + }; if (x.iconType === "svg") { r.push(join("../../icons", `${x.iconName}.svg`)); From 2c3a9cab039548b67470dbd9001f579b4dc39772 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 29 Apr 2024 13:46:23 -0700 Subject: [PATCH 17/17] Update script/sync-ghes/index.ts --- script/sync-ghes/index.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts index 204294690d..fcdaaad5e2 100755 --- a/script/sync-ghes/index.ts +++ b/script/sync-ghes/index.ts @@ -196,9 +196,6 @@ async function checkWorkflow( }) ), ]); - - // Add back Pages icons - } catch (e) { console.error("Unhandled error while syncing workflows", e); process.exitCode = 1;