ci: fix Gitea Actions workflow
This commit is contained in:
1 parent
cc95a0d690
commit
91357aca3b
4 files changed
+52
-38
No files matched your search
+2
-38
@@ -1,50 +1,14 @@
|
|||||||
name: CI
|
name: CI
|
||||||
on:
|
on: [push, pull_request]
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
env:
|
|
||||||
NEXT_TELEMETRY_DISABLED: "1"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
ci:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: node:22-slim
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: corepack enable && corepack prepare [email protected] --activate
|
- run: corepack enable && corepack prepare [email protected] --activate
|
||||||
- run: pnpm install --frozen-lockfile
|
- run: pnpm install --frozen-lockfile
|
||||||
- run: pnpm biome:lint
|
- run: pnpm biome:lint
|
||||||
|
|
||||||
typecheck:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: node:22-slim
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- run: corepack enable && corepack prepare [email protected] --activate
|
|
||||||
- run: pnpm install --frozen-lockfile
|
|
||||||
- run: pnpm typecheck
|
- run: pnpm typecheck
|
||||||
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: node:22-slim
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- run: corepack enable && corepack prepare [email protected] --activate
|
|
||||||
- run: pnpm install --frozen-lockfile
|
|
||||||
- run: pnpm test
|
- run: pnpm test
|
||||||
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: node:22-slim
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- run: corepack enable && corepack prepare [email protected] --activate
|
|
||||||
- run: pnpm install --frozen-lockfile
|
|
||||||
- run: pnpm build
|
- run: pnpm build
|
||||||
Executable
+1
@@ -0,0 +1 @@
|
|||||||
|
pnpm exec lint-staged
|
||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
pnpm typecheck
|
||||||
|
pnpm test
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const JSON5 = require('json5');
|
||||||
|
|
||||||
|
const exampleFile = process.argv[2];
|
||||||
|
const targetFile = process.argv[3];
|
||||||
|
|
||||||
|
if (!exampleFile || !targetFile) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deepMerge(target, source) {
|
||||||
|
const result = { ...target };
|
||||||
|
for (const key of Object.keys(source)) {
|
||||||
|
if (source[key] !== null && typeof source[key] === 'object' && !Array.isArray(source[key])) {
|
||||||
|
result[key] = deepMerge(target[key] || {}, source[key]);
|
||||||
|
} else {
|
||||||
|
if (!(key in result)) {
|
||||||
|
result[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
let example;
|
||||||
|
try {
|
||||||
|
const content = fs.readFileSync(exampleFile, 'utf-8');
|
||||||
|
example = JSON5.parse(content);
|
||||||
|
} catch {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
let current = {};
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(targetFile)) {
|
||||||
|
const content = fs.readFileSync(targetFile, 'utf-8');
|
||||||
|
current = JSON5.parse(content);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
current = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const merged = deepMerge(current, example);
|
||||||
|
|
||||||
|
const isJson5 = targetFile.endsWith('.json5');
|
||||||
|
const output = isJson5 ? JSON5.stringify(merged, null, 4) : JSON.stringify(merged, null, 4);
|
||||||
|
fs.writeFileSync(targetFile, output + '\n');
|
||||||
Reference in new issue
Block a user