Skip to content

Commit

Permalink
ci: Generate workflow (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev authored Mar 28, 2024
1 parent c43c341 commit 37483c9
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 8 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/generate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Generated Files are Updated
on:
pull_request:
branches:
- "*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq unzip
yarn install
- name: Generate Files
run: |
yarn generate
- name: Check for changes
run: |
if git diff --exit-code --ignore-space-change --ignore-all-space --ignore-cr-at-eol -- pkg src; then
echo "Generated files are up-to-date."
else
echo "::error::Generated files are not up-to-date. Please run 'yarn generate' locally and commit any changes."
exit 1
fi
18 changes: 14 additions & 4 deletions networks.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"required": [
"url",
"type"
]
],
"additionalProperties": false
}
},
"patternProperties": {
Expand All @@ -43,7 +44,14 @@
"type": "string"
},
"bech32_prefix": {
"type": "string"
"type": "string",
"nullable": true
},
"chain_aliases": {
"type": "array",
"items": {
"type": "string"
}
},
"fees": {
"type": "object",
Expand Down Expand Up @@ -141,7 +149,8 @@
"denom": {
"type": "string"
}
}
},
"nullable": true
},
"api": {
"type": "array",
Expand All @@ -153,7 +162,8 @@
"required": [
"chain_id",
"chain_name"
]
],
"additionalProperties": false
}
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"scripts": {
"output": "npx ts-node scripts/output.ts",
"validate": "npx ts-node scripts/validate.ts",
"build": "rm -rf dist && yarn generate:types && tsc",
"build": "rm -rf dist && yarn generate && tsc",
"lint:fix": "npx eslint . --ext .js,.ts --fix",
"lint": "npx eslint . --ext .js,.ts",
"prepublishOnly": "npm run build",
"generate:types": "npx json-schema-to-typescript networks.schema.json > src/types.ts"
"generate": "npx json-schema-to-typescript networks.schema.json > src/types.ts"
},
"keywords": [],
"author": "",
Expand Down
3 changes: 1 addition & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface NetworksSchema {
chain_id: number;
chain_name: string;
bech32_prefix?: string;
chain_aliases?: string[];
fees?: {
assets?: {
denom: string;
Expand Down Expand Up @@ -56,11 +57,9 @@ export interface NetworksSchema {
[k: string]: unknown;
};
api?: Api[];
[k: string]: unknown;
};
}
export interface Api {
url: string;
type: ApiType;
[k: string]: unknown;
}

0 comments on commit 37483c9

Please sign in to comment.