From 2eeba298ab97bee9caab3917f05743e9cf49e1e9 Mon Sep 17 00:00:00 2001 From: 0xkenj1 <165053496+0xkenj1@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:11:44 -0300 Subject: [PATCH] feat: json validation workflow (#4) * feat: add validation workflow --------- Co-authored-by: nigiri <168690269+0xnigir1@users.noreply.github.com> --- .github/workflows/validate_json.yaml | 31 ++++++++++++++++++++++++++++ README.md | 18 ++++++++-------- 2 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/validate_json.yaml diff --git a/.github/workflows/validate_json.yaml b/.github/workflows/validate_json.yaml new file mode 100644 index 0000000..6070bee --- /dev/null +++ b/.github/workflows/validate_json.yaml @@ -0,0 +1,31 @@ +name: Validate JSON + +on: + push: + paths: + - '**/*.json' + pull_request: + paths: + - '**/*.json' + +jobs: + json-validation: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install jq + run: sudo apt-get update && sudo apt-get install -y jq + + - name: Validate JSON files + run: | + find . -name "*.json" -print0 | while IFS= read -r -d '' file; do + echo "Validating $file" + if jq empty "$file"; then + echo "Valid JSON: $file" + else + echo "Invalid JSON in file: $file" + exit 1 + fi + done diff --git a/README.md b/README.md index f9c4841..7a05ef8 100644 --- a/README.md +++ b/README.md @@ -12,24 +12,24 @@ This file contains an array of Chain metadata. To add a new one, follow the foll ```json { - "chainId": 324, //mandatory - "name": "ZKsyncERA", //mandatory - "iconUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/24091.png", //optional + "chainId": 324, // mandatory + "name": "ZKsyncERA", // mandatory + "iconUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/24091.png", // optional "publicRpcs": [ "https://mainnet.era.zksync.io", "https://zksync.drpc.org", "https://zksync.meowrpc.com" ], //optional, - "explorerUrl": "https://explorer.zksync.io/", //optional - "launchDate": 1679626800, //mandatory + "explorerUrl": "https://explorer.zksync.io/", // optional + "launchDate": 1679626800, // mandatory "chainType": "Rollup", // "Rollup" | "Validium" "baseToken": { - "name": "Ether", //mandatory - "symbol": "ETH", //mandatory + "name": "Ether", // mandatory + "symbol": "ETH", // mandatory "type": "native", // "native" | "erc20" "contractAddress": null, // null if "native", address if "erc20" - "imageUrl": "https://coin-images.coingecko.com/coins/images/279/large/ethereum.png?1696501628", //optional - "decimals": 18 //mandatory + "imageUrl": "https://coin-images.coingecko.com/coins/images/279/large/ethereum.png?1696501628", // optional + "decimals": 18 // mandatory } } ```