Allow syncing .md starter workflows to GHES
This commit is contained in:
@@ -8,6 +8,7 @@ import { normalizeSvgIconName } from "../shared/icon-utils";
|
|||||||
interface WorkflowDesc {
|
interface WorkflowDesc {
|
||||||
folder: string;
|
folder: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
fileExtension: string;
|
||||||
iconName?: string;
|
iconName?: string;
|
||||||
iconType?: "svg" | "octicon";
|
iconType?: "svg" | "octicon";
|
||||||
}
|
}
|
||||||
@@ -48,9 +49,10 @@ async function checkWorkflows(
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (const e of dir) {
|
for (const e of dir) {
|
||||||
if (e.isFile() && extname(e.name) === ".yml") {
|
if (e.isFile() && (".yml" === extname(e.name) || ".md" === extname(e.name))) {
|
||||||
|
const fileExtension = extname(e.name);
|
||||||
const workflowFilePath = join(folder, e.name);
|
const workflowFilePath = join(folder, e.name);
|
||||||
const workflowId = basename(e.name, extname(e.name));
|
const workflowId = basename(e.name, fileExtension);
|
||||||
const workflowProperties: WorkflowProperties = require(join(
|
const workflowProperties: WorkflowProperties = require(join(
|
||||||
folder,
|
folder,
|
||||||
"properties",
|
"properties",
|
||||||
@@ -67,11 +69,12 @@ async function checkWorkflows(
|
|||||||
const enabled =
|
const enabled =
|
||||||
!isPartnerWorkflow &&
|
!isPartnerWorkflow &&
|
||||||
(workflowProperties.enterprise === true || basename(folder) !== 'code-scanning') &&
|
(workflowProperties.enterprise === true || basename(folder) !== 'code-scanning') &&
|
||||||
(await checkWorkflow(workflowFilePath, enabledActions));
|
(fileExtension === ".md" || await checkWorkflow(workflowFilePath, enabledActions));
|
||||||
|
|
||||||
const workflowDesc: WorkflowDesc = {
|
const workflowDesc: WorkflowDesc = {
|
||||||
folder,
|
folder,
|
||||||
id: workflowId,
|
id: workflowId,
|
||||||
|
fileExtension,
|
||||||
iconName: normalizedSvgIconName,
|
iconName: normalizedSvgIconName,
|
||||||
iconType:
|
iconType:
|
||||||
normalizedSvgIconName && normalizedSvgIconName.startsWith("octicon") ? "octicon" : "svg",
|
normalizedSvgIconName && normalizedSvgIconName.startsWith("octicon") ? "octicon" : "svg",
|
||||||
@@ -189,7 +192,7 @@ async function checkWorkflow(
|
|||||||
|
|
||||||
// Don't touch read-only folders
|
// Don't touch read-only folders
|
||||||
if (!settings.readOnlyFolders.includes(x.folder)) {
|
if (!settings.readOnlyFolders.includes(x.folder)) {
|
||||||
r.push(join(x.folder, `${x.id}.yml`));
|
r.push(join(x.folder, `${x.id}${x.fileExtension}`));
|
||||||
r.push(join(x.folder, "properties", `${x.id}.properties.json`));
|
r.push(join(x.folder, "properties", `${x.id}.properties.json`));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -210,6 +213,7 @@ async function checkWorkflow(
|
|||||||
// The v4 versions of upload and download artifact are not yet supported on GHES
|
// The v4 versions of upload and download artifact are not yet supported on GHES
|
||||||
console.group("Updating all compatible workflows to use v3 of the artifact actions");
|
console.group("Updating all compatible workflows to use v3 of the artifact actions");
|
||||||
for (const workflow of result.compatibleWorkflows) {
|
for (const workflow of result.compatibleWorkflows) {
|
||||||
|
if (workflow.fileExtension !== ".yml") continue;
|
||||||
const path = join(workflow.folder, `${workflow.id}.yml`);
|
const path = join(workflow.folder, `${workflow.id}.yml`);
|
||||||
console.log(`Updating ${path}`);
|
console.log(`Updating ${path}`);
|
||||||
const contents = await fs.readFile(path, "utf8");
|
const contents = await fs.readFile(path, "utf8");
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
"../../ci",
|
"../../ci",
|
||||||
"../../automation",
|
"../../automation",
|
||||||
"../../code-scanning",
|
"../../code-scanning",
|
||||||
"../../pages"
|
"../../pages",
|
||||||
|
"../../agentic"
|
||||||
],
|
],
|
||||||
"readOnlyFolders": [
|
"readOnlyFolders": [
|
||||||
"../../pages"
|
"../../pages"
|
||||||
|
|||||||
Reference in New Issue
Block a user