mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 14:54:05 +00:00
Verify language json files format (#5233)
Some checks failed
json-yaml-validate / check-lang-json (push) Has been cancelled
Auto Test / auto-test (18, ARM64) (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Auto Test / auto-test (18, macos-latest) (push) Has been cancelled
Auto Test / auto-test (18, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (18, windows-latest) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-latest) (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
Auto Test / armv7-simple-test (18, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
json-yaml-validate / json-yaml-validate (push) Has been cancelled
Some checks failed
json-yaml-validate / check-lang-json (push) Has been cancelled
Auto Test / auto-test (18, ARM64) (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Auto Test / auto-test (18, macos-latest) (push) Has been cancelled
Auto Test / auto-test (18, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (18, windows-latest) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-latest) (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
Auto Test / armv7-simple-test (18, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
json-yaml-validate / json-yaml-validate (push) Has been cancelled
This commit is contained in:
parent
7a82ae039c
commit
79a26180af
2 changed files with 37 additions and 0 deletions
10
.github/workflows/json-yaml-validate.yml
vendored
10
.github/workflows/json-yaml-validate.yml
vendored
|
@ -25,3 +25,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
comment: "true" # enable comment mode
|
comment: "true" # enable comment mode
|
||||||
exclude_file: ".github/config/exclude.txt" # gitignore style file for exclusions
|
exclude_file: ".github/config/exclude.txt" # gitignore style file for exclusions
|
||||||
|
|
||||||
|
check-lang-json:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Use Node.js 20
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- run: node ./extra/check-lang-json.js
|
||||||
|
|
27
extra/check-lang-json.js
Normal file
27
extra/check-lang-json.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// For #5231
|
||||||
|
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
let path = "./src/lang";
|
||||||
|
|
||||||
|
// list directories in the lang directory
|
||||||
|
let jsonFileList = fs.readdirSync(path);
|
||||||
|
|
||||||
|
for (let jsonFile of jsonFileList) {
|
||||||
|
if (!jsonFile.endsWith(".json")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let jsonPath = path + "/" + jsonFile;
|
||||||
|
let originalContent = fs.readFileSync(jsonPath, "utf8");
|
||||||
|
let langData = JSON.parse(originalContent);
|
||||||
|
|
||||||
|
let formattedContent = JSON.stringify(langData, null, 4) + "\n";
|
||||||
|
|
||||||
|
if (originalContent !== formattedContent) {
|
||||||
|
console.error(`File ${jsonFile} is not formatted correctly.`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("All lang json files are formatted correctly.");
|
Loading…
Reference in a new issue