forked from CytopiaTeam/Cytopia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👷 Added gh-action for checking if images exist
- Loading branch information
1 parent
0dcdb72
commit 435d398
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Check for missing images | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Check if images exist | ||
run: node ./tools/CI/check-jsons.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require("fs") | ||
const pwd = process.cwd() | ||
|
||
|
||
let TileDataRaw = fs.readFileSync(`${pwd}/data/resources/data/TileData.json`, "utf8") | ||
let TileData = JSON.parse(TileDataRaw) | ||
|
||
let failed = 0 | ||
|
||
TileData.forEach(e => { | ||
let ex = fs.existsSync(`${pwd}/data/${e.tiles.fileName}`) | ||
if (!ex){ | ||
console.error(`File does not exist: ${e.tiles.fileName}`) | ||
failed = 1 | ||
} | ||
}) | ||
|
||
let UIDataRaw = fs.readFileSync(`${pwd}/data/resources/data/UIData.json`, "utf8") | ||
let UIData = JSON.parse(UIDataRaw) | ||
|
||
for (const [_, ent] of Object.entries(UIData)) { | ||
for (const [_, image] of Object.entries(ent)){ | ||
let ex = fs.existsSync(`${pwd}/data/${image}`) | ||
if (!ex){ | ||
console.error(`File does not exist: ${image}`) | ||
failed = 1 | ||
} | ||
} | ||
} | ||
|
||
|
||
process.exit(failed) |