Files
proxmox/scripts/run-before-pr-validations.sh
defiQUG ec6217fdc3
All checks were successful
Deploy to Phoenix / validate (push) Successful in 1m15s
Deploy to Phoenix / deploy (push) Successful in 43s
Deploy to Phoenix / deploy-atomic-swap-dapp (push) Successful in 1m33s
phoenix-deploy Deployed to cloudflare-sync
Deploy to Phoenix / cloudflare (push) Successful in 38s
Clean up pre-PR validation workflow
2026-05-07 07:55:02 -07:00

44 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Run all validations before opening PRs (Chainlist, token list).
# See: docs/04-configuration/PR_ADDITIONS_VALIDATION_REPORT.md
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
CHAINS_DIR="${CHAINS_DIR:-$HOME/projects/chains}"
TOKEN_LISTS_DIR="${TOKEN_LISTS_DIR:-$HOME/projects/token-lists}"
log() { echo "[$(date +%H:%M:%S)] $*"; }
err() { echo "ERROR: $*" >&2; }
# 1. Chains validation (ethereum-lists/chains)
log "1. Chains validation..."
if [[ -d "$CHAINS_DIR" ]]; then
cp "$REPO_ROOT/docs/04-configuration/pr-ready/eip155-138.json" "$CHAINS_DIR/_data/chains/"
(cd "$CHAINS_DIR" && npx prettier --write _data/chains/eip155-138.json 2>/dev/null)
(cd "$CHAINS_DIR" && ./gradlew run -q) && log " Chains: OK" || { err "Chains validation failed"; exit 1; }
else
log " Chains: SKIP (CHAINS_DIR not found: $CHAINS_DIR)"
fi
# 2. Token list schema validation
log "2. Token list schema validation..."
if [[ -d "$TOKEN_LISTS_DIR" ]]; then
(cd "$TOKEN_LISTS_DIR" && node -e "
const Ajv = require('ajv');
const addFormats = require('ajv-formats');
const schema = require('./src/tokenlist.schema.json');
const ajv = new Ajv({ allErrors: true });
addFormats(ajv);
const validate = ajv.compile(schema);
const list = require('$REPO_ROOT/token-lists/lists/dbis-138.tokenlist.json');
if (!validate(list)) { console.error(JSON.stringify(validate.errors, null, 2)); process.exit(1); }
console.log('Token list: OK');
") && log " Token list: OK" || { err "Token list validation failed"; exit 1; }
else
log " Token list: SKIP (TOKEN_LISTS_DIR not found: $TOKEN_LISTS_DIR)"
fi
log "Done. All validations passed."