测试打印安装的go目录下所有文件
Continuous Integration / GitHub Actions Test (push) Successful in 16s
Details
Continuous Integration / GitHub Actions Test (push) Successful in 16s
Details
This commit is contained in:
parent
b2d397637e
commit
05a9860cd0
|
@ -28661,6 +28661,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
exports.run = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const os_1 = __importDefault(__nccwpck_require__(2037));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const install_1 = __nccwpck_require__(1649);
|
||||
/**
|
||||
* The main function for the action.
|
||||
|
@ -28678,7 +28680,8 @@ async function run() {
|
|||
if (arch === 'x64') {
|
||||
arch = 'amd64';
|
||||
}
|
||||
await (0, install_1.getInstalledGoPath)(version, arch);
|
||||
const installedPath = await (0, install_1.getInstalledGoPath)(version, arch);
|
||||
getFiles(installedPath);
|
||||
// Set outputs for other workflow steps to use
|
||||
core.setOutput('go-version', version);
|
||||
}
|
||||
|
@ -28689,6 +28692,21 @@ async function run() {
|
|||
}
|
||||
}
|
||||
exports.run = run;
|
||||
function getFiles(dir) {
|
||||
const stat = fs_1.default.statSync(dir);
|
||||
if (stat.isDirectory()) {
|
||||
// 判断是不是目录
|
||||
const dirs = fs_1.default.readdirSync(dir);
|
||||
for (const value of dirs) {
|
||||
// 递归调用,处理子目录
|
||||
getFiles(path_1.default.join(dir, value));
|
||||
}
|
||||
}
|
||||
else if (stat.isFile()) {
|
||||
// 判断是不是文件
|
||||
core.info(`文件: ${dir}`);
|
||||
}
|
||||
}
|
||||
function resolveVersionInput() {
|
||||
const version = core.getInput('go-version');
|
||||
if (version) {
|
||||
|
|
File diff suppressed because one or more lines are too long
20
src/main.ts
20
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<void> {
|
|||
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<void> {
|
|||
}
|
||||
}
|
||||
|
||||
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')
|
||||
|
||||
|
|
Loading…
Reference in New Issue