Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
447 changes: 224 additions & 223 deletions .github/copilot-instructions.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions .github/workflows/Validate_Pull_Request.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Validate Pull Request

on:
pull_request_target:
pull_request:
branches:
- main

jobs:
qodo:
if: ${{ github.event.sender.type != 'Bot' }}
if: ${{ github.event.sender.type != 'Bot' && github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
Expand All @@ -16,11 +16,11 @@ jobs:
steps:
- name: PR Agent action step
id: pragent
uses: qodo-ai/pr-agent@0b0c175f6a0ae73f75bfb12a0eecb440a216a891 # pin@v0.33
uses: qodo-ai/pr-agent@0b0c175f6a0ae73f75bfb12a0eecb440a216a891 # pin@v0.33
env:
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github_action_config.auto_review: "true"
github_action_config.auto_describe: "true"
github_action_config.auto_improve: "true"
github_action_config.pr_actions: '["opened", "reopened"]'
github_action_config.pr_actions: '["opened", "reopened"]'
78 changes: 38 additions & 40 deletions .github/workflows/full-info.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
name: Get full info
on:
workflow_call:

jobs:
generate:
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: write

steps:
- name: Checkout repository to get info from
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # pin@v7.0.1

- name: Checkout metadata-validation-scripts
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # pin@v7.0.1
with:
name: Get full info
on:
workflow_call:
jobs:
generate:
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: write
steps:
- name: Checkout repository to get info from
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # pin@v7.0.1
- name: Checkout metadata-validation-scripts
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # pin@v7.0.1
with:
repository: symbioticfi/metadata-validation-scripts
ref: main
path: metadata-validation-scripts

- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # pin@v6.2.0
with:
node-version: '22'

- name: Install dependencies
run: npm install tsx @actions/core @actions/github


- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # pin@v6.2.0
with:
node-version: '22'

- name: Generate
run: npx tsx metadata-validation-scripts/.github/workflows/scripts/extract-metadata.ts

- name: Release latest full info
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # pin@v3.0.2
with:
name: latest
tag_name: latest
files: full-info.json
fail_on_unmatched_files: true

# Sleep to be sure release is updated in GH CDN before triggering a webhook
- name: Sleep for 30 seconds
run: sleep 30s
run: node metadata-validation-scripts/.github/workflows/scripts/extract-metadata.mjs
- name: Release latest full info
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # pin@v3.0.2
with:
name: latest
tag_name: latest
files: full-info.json
fail_on_unmatched_files: true
# Sleep to be sure release is updated in GH CDN before triggering a webhook
- name: Sleep for 30 seconds
run: sleep 30s
65 changes: 65 additions & 0 deletions .github/workflows/scripts/extract-metadata.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import fs from "fs/promises";
import path from "path";
import { pathToFileURL } from "url";

const DIRECTORIES = Object.freeze([
"vaults",
"tokens",
"networks",
"operators",
"points",
"curators",
"adapters",
]);

async function grabEntitiesInfo(globalDirs) {
const repoPath = process.env.GITHUB_REPOSITORY;
if (!repoPath) {
throw new Error("GITHUB_REPOSITORY is required");
}

const result = Object.fromEntries(DIRECTORIES.map((directory) => [directory, {}]));

for (const directory of globalDirs) {
const directoryStats = await fs.stat(directory).catch(() => null);
if (!directoryStats?.isDirectory()) {
continue;
}

try {
const subdirectories = await fs.readdir(directory, { withFileTypes: true });
for (const subdirectory of subdirectories) {
if (!subdirectory.isDirectory()) {
continue;
}

const entityPath = path.join(directory, subdirectory.name);
try {
const infoPath = path.join(entityPath, "info.json");
const logoPath = path.join(entityPath, "logo.png");
const info = JSON.parse(await fs.readFile(infoPath, "utf8"));
const entity = { info };
const logoStats = await fs.stat(logoPath).catch(() => null);

if (logoStats?.isFile()) {
entity.logo = `https://raw.githubusercontent.com/${repoPath}/main/${entityPath.replaceAll(path.sep, "/")}/logo.png`;
}

result[directory][subdirectory.name] = entity;
} catch (error) {
console.error(`Error processing entity ${entityPath}`, error);
}
}
} catch (error) {
console.error(`Error reading directory ${directory}`, error);
}
}

const outputPath = path.join(process.cwd(), "full-info.json");
await fs.writeFile(outputPath, JSON.stringify(result, null, "\t"), "utf8");
}

grabEntitiesInfo(DIRECTORIES).catch((error) => {
console.error("Failed to generate full-info.json", error);
process.exitCode = 1;
});
Loading