This commit is contained in:
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@@ -40,11 +40,17 @@ jobs:
|
||||
pnpm --version
|
||||
echo "✅ 包管理器安装成功"
|
||||
|
||||
- name: 准备 | 获取项目依赖哈希
|
||||
id: files-hash
|
||||
uses: ./
|
||||
with:
|
||||
files: '**/pnpm-lock.yaml'
|
||||
|
||||
- name: 准备 | 配置依赖缓存
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ steps.files-hash.outputs.hash }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
@@ -56,7 +62,7 @@ jobs:
|
||||
- name: 测试 | 执行语法检查
|
||||
run: |
|
||||
echo "🔍 执行 JavaScript 语法检查..."
|
||||
node -c index.js
|
||||
node -c src/index.js
|
||||
echo "✅ 语法检查通过"
|
||||
|
||||
- name: 测试 | 执行 Lint 检查
|
||||
@@ -76,4 +82,3 @@ jobs:
|
||||
echo "🧪 执行测试..."
|
||||
pnpm run test
|
||||
echo "✅ 测试通过"
|
||||
|
||||
|
||||
@@ -72,10 +72,10 @@ jobs:
|
||||
|
||||
## 输入参数
|
||||
|
||||
| 输入参数 | 描述 | 必需 | 默认值 |
|
||||
| ----------------- | ------------------------------------------- | ----- | -------- |
|
||||
| `files` | 文件路径或 glob 模式(每行一个) | ✅ 是 | - |
|
||||
| `algorithm` | 哈希算法:`md5`、`sha1`、`sha256`、`sha512` | ❌ 否 | `sha256` |
|
||||
| 输入参数 | 描述 | 必需 | 默认值 |
|
||||
| ----------- | ------------------------------------------- | ----- | -------- |
|
||||
| `files` | 文件路径或 glob 模式(每行一个) | ✅ 是 | - |
|
||||
| `algorithm` | 哈希算法:`md5`、`sha1`、`sha256`、`sha512` | ❌ 否 | `sha256` |
|
||||
|
||||
### 文件模式
|
||||
|
||||
|
||||
@@ -22,4 +22,4 @@ outputs:
|
||||
|
||||
runs:
|
||||
using: 'node20'
|
||||
main: 'index.js'
|
||||
main: 'src/index.js'
|
||||
|
||||
10
package.json
10
package.json
@@ -2,15 +2,15 @@
|
||||
"name": "files-hash-action",
|
||||
"version": "0.1.1",
|
||||
"description": "A lightweight Gitea Action to calculate hash of multiple files",
|
||||
"main": "index.js",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest watch",
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check .",
|
||||
"lint": "eslint ./src",
|
||||
"lint:fix": "eslint ./src --fix",
|
||||
"format": "prettier --write ./src",
|
||||
"format:check": "prettier --check ./src",
|
||||
"check": "pnpm run lint && pnpm run format:check",
|
||||
"preinstall": "npx only-allow pnpm"
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
ErrorType,
|
||||
ActionInputs,
|
||||
ActionOutputs,
|
||||
} from '../index.js';
|
||||
} from '../src/index.js';
|
||||
import { createTestFile, createTestDir, cleanupTestFiles, cleanupTestDirs } from './utils.js';
|
||||
|
||||
describe('测试 FileDiscovery 类', () => {
|
||||
|
||||
Reference in New Issue
Block a user