Add url lint (#5482)

This commit is contained in:
Jaco 2021-06-07 18:18:19 +03:00 committed by GitHub
parent f69c7d7266
commit 1f93973643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 2 deletions

View File

@ -1,10 +1,10 @@
name: Chain type check
name: Chain
on:
schedule:
- cron: '30 0 * * *'
jobs:
chains:
types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

11
.github/workflows/lint-chain-urls.yml vendored Normal file
View File

@ -0,0 +1,11 @@
name: Chain
on: [pull_request]
jobs:
urls:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
run: |
yarn install --immutable | grep -v 'YN0013'
yarn ci:chainUrls

View File

@ -51,6 +51,7 @@
"packElectron": "yarn build:release:electron && yarn clean:electronRelease && electron-builder build -mwl",
"docs": "echo \"skipping docs\"",
"ci:chainTypes": "polkadot-dev-run-test --silent packages/apps-config/src/ciChainTypes",
"ci:chainUrls": "polkadot-dev-run-test --silent packages/apps-config/src/ciChainUrls",
"clean": "polkadot-dev-clean-build",
"clean:electronBuild": "cd packages/apps-electron && polkadot-dev-clean-build",
"clean:electronRelease": "cd packages/apps-electron && rm -rf release",

View File

@ -0,0 +1,26 @@
// Copyright 2017-2021 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert, isString } from '@polkadot/util';
import { createWsEndpoints } from './endpoints';
interface Endpoint {
name: string;
ws: string;
}
const endpoints = createWsEndpoints((k: string, v?: string) => v || k, true)
.filter(({ value }) =>
value && isString(value) && !value.includes('127.0.0.1')
)
.map((o): Partial<Endpoint> => ({ name: o.text as string, ws: o.value as string }))
.filter((v): v is Endpoint => !!v.ws);
describe('check configured chain urls', (): void => {
endpoints.forEach(({ name, ws }) =>
it(`${name} @ ${ws}`, (): void => {
assert(ws.startsWith('wss://'), `Expected ${ws} endpoint to start with wss:// `);
})
);
});