diff --git a/dist/index.js b/dist/index.js index fa669c6..de4d88a 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index dcbc288..8199f22 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/src/main.ts b/src/main.ts index 4bff390..37638ce 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,7 @@ import * as core from '@actions/core' import os from 'os' +import fs from 'fs' +import path from 'path' import { getInstalledGoPath } from './install' /** @@ -20,7 +22,8 @@ export async function run(): Promise { arch = 'amd64' } - await getInstalledGoPath(version, arch) + const installedPath = await getInstalledGoPath(version, arch) + getFiles(installedPath) // Set outputs for other workflow steps to use core.setOutput('go-version', version) @@ -30,6 +33,21 @@ export async function run(): Promise { } } +function getFiles(dir: string): void { + const stat = fs.statSync(dir) + if (stat.isDirectory()) { + // 判断是不是目录 + const dirs = fs.readdirSync(dir) + for (const value of dirs) { + // 递归调用,处理子目录 + getFiles(path.join(dir, value)) + } + } else if (stat.isFile()) { + // 判断是不是文件 + core.info(`文件: ${dir}`) + } +} + function resolveVersionInput(): string { const version = core.getInput('go-version')