From 4e90caedb5c7ad01fea47b6f817a4dca573bff54 Mon Sep 17 00:00:00 2001 From: jill64 Date: Thu, 21 Dec 2023 01:14:51 +0900 Subject: [PATCH 1/2] Refactor listWorkflowFiles to use path.join and add error handling --- .../src/ghosts/docs/utils/listWorkflowFiles.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/action/src/ghosts/docs/utils/listWorkflowFiles.ts b/packages/action/src/ghosts/docs/utils/listWorkflowFiles.ts index 3247fb30..d3834c8a 100644 --- a/packages/action/src/ghosts/docs/utils/listWorkflowFiles.ts +++ b/packages/action/src/ghosts/docs/utils/listWorkflowFiles.ts @@ -1,12 +1,18 @@ +import { attempt } from '@jill64/attempt' import { readdir, readFile } from 'node:fs/promises' import path from 'node:path' export const listWorkflowFiles = async () => { - const dirPath = '.github/workflows' - const dir = await readdir(dirPath, { - withFileTypes: true, - recursive: true - }) + const dirPath = path.join(process.cwd(), '.github/workflows') + + const dir = await attempt( + () => + readdir(dirPath, { + withFileTypes: true, + recursive: true + }), + [] + ) const result = dir .filter((dirent) => dirent.isFile()) From a21c5e491678ee633c8b4f5dbe0b0aa3bc5404a6 Mon Sep 17 00:00:00 2001 From: "wraith-ci[bot]" Date: Wed, 20 Dec 2023 16:15:54 +0000 Subject: [PATCH 2/2] chore: regenerate artifact --- packages/action/dist/index.cjs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/action/dist/index.cjs b/packages/action/dist/index.cjs index 58ba5621..dc82aa85 100644 --- a/packages/action/dist/index.cjs +++ b/packages/action/dist/index.cjs @@ -34358,11 +34358,14 @@ var updateReadmeList = async ({ var import_promises6 = require("node:fs/promises"); var import_node_path4 = __toESM(require("node:path"), 1); var listWorkflowFiles = async () => { - const dirPath = ".github/workflows"; - const dir = await (0, import_promises6.readdir)(dirPath, { - withFileTypes: true, - recursive: true - }); + const dirPath = import_node_path4.default.join(process.cwd(), ".github/workflows"); + const dir = await attempt( + () => (0, import_promises6.readdir)(dirPath, { + withFileTypes: true, + recursive: true + }), + [] + ); const result = dir.filter((dirent) => dirent.isFile()).map(async (file) => { const filepath = import_node_path4.default.join(dirPath, file.name); const data = await (0, import_promises6.readFile)(filepath, "utf-8");