Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test2 #12

Merged
merged 5 commits into from
Oct 14, 2024
Merged
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
60 changes: 24 additions & 36 deletions .github/scripts/validate-and-merge.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createRequire } from 'module';
import fetch from 'node-fetch';
import yaml from 'js-yaml';

const require = createRequire(import.meta.url);
const fs = require('fs');



const owner = process.env.REPO_OWNER;
const repo = process.env.REPO_NAME;
const pull_number = process.env.PR_NUMBER;
Expand All @@ -28,6 +28,7 @@ async function validateAndMerge() {
fetch: fetch,
},
});

try {
const { data: pr } = await octokit.pulls.get({
owner,
Expand All @@ -41,50 +42,37 @@ async function validateAndMerge() {
pull_number,
});

const jsonFile = files.find(file => file.filename === 'programs.json');
if (!jsonFile || files.length > 1) {
console.log('PR does not modify only the target JSON file');
const yamlFile = files.find(file => file.filename.endsWith('.yaml') || file.filename.endsWith('.yml'));

if (!yamlFile) {
console.log('No YAML file found in the PR');
return;
}

const { data: fileContent } = await octokit.repos.getContent({
owner,
repo,
path: jsonFile.filename,
path: yamlFile.filename,
ref: pr.head.ref,
});

const content = Buffer.from(fileContent.content, 'base64').toString('utf-8');
const jsonContent = JSON.parse(content);

if (!Array.isArray(jsonContent)) {
console.log('JSON content is not an array');
return;
}

const { data: diff } = await octokit.pulls.get({
owner,
repo,
pull_number,
mediaType: { format: 'diff' }
});

const addedLines = diff.split('\n')
.filter(line => line.startsWith('+') && !line.startsWith('+++'))
.map(line => line.slice(1).trim());

const addedContent = JSON.parse(addedLines.join(''));

const isValid = requiredKeys.every(key => key in addedContent);

if (!isValid) {
console.log('Added object does not contain all required keys');
return;
}

if (!Array.isArray(addedContent.categories) || addedContent.categories.length === 0) {
console.log('Categories must be a non-empty array');
return;

// Parse all YAML documents in the file
const yamlDocuments = yaml.loadAll(content);

for (const document of yamlDocuments) {
const isValid = requiredKeys.every(key => key in document);

if (!isValid) {
console.log('Added object does not contain all required keys');
return;
}

if (!Array.isArray(document.categories) || document.categories.length === 0) {
console.log('Categories must be a non-empty array');
return;
}
}

await octokit.pulls.merge({
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"type": "module",
"dependencies": {
"@octokit/rest": "^21.0.2",
"js-yaml": "^4.1.0",
"node-fetch": "^3.3.2"
}
}
106 changes: 0 additions & 106 deletions programs.json

This file was deleted.

84 changes: 84 additions & 0 deletions programs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
- name: canonical_bridge
description: The Eclipse Canonical Bridge facilitates depositing and withdrawing ether from the Eclipse Chain
repo: https://github.com/Eclipse-Laboratories-Inc/syzygy/tree/main/solana-programs/canonical_bridge
icon: https://i.imgur.com/y0JEPfQ.png
framework: Anchor
program_address: br1xwubggTiEZ6b7iNZUwfA3psygFfaXGfZ1heaN9AW
categories:
- Bridge

- name: Lifinity
description: The first oracle-based DEX on Eclipse, designed to improve capital efficiency and reduce impermanent loss.
repo: https://github.com/Lifinity-Labs/lifinity-amm-v2-eclipse
icon: https://v1.lifinity.io/logo/LFNTY.svg
framework: Anchor
program_address: LfacfEjtujQTWBXZVzgkiPBw7Mt4guHSsmAi7y3cycL
categories:
- DEX

- name: EclipseGames
description: Support for the creation of mini-games on the Eclipse blockchain
repo: https://github.com/cryptohunter0x1/EclipseGames.git
icon: https://i.imgur.com/YU8jVSb.jpeg
framework: Anchor
program_address: GYLvUjL1JUjFfqVvEK4C8EKFMh93B1ZzrQsQceRDEHeB
categories:
- games

- name: Save
description: save lending protocol
repo: https://github.com/solendprotocol/solana-program-library
icon: https://save.finance/assets/tokens/save.svg
framework: n/a
program_address: So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo
categories:
- borrow
- lend

- name: Orca
description: Orca is the primary liquidity layer of Eclipse where users can quickly, affordably, and reliably transact on a peer-to-peer basis trading or providing liquidity of SPL tokens.
repo: https://github.com/orca-so/whirlpools
icon: https://i.imgur.com/eTO4KwA.png
framework: Anchor
program_address: whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc
categories:
- DEX

- name: Blip Radar
description: Send messages to any wallet
repo: https://github.com/Eclipse-Validators/blip-radar
icon: https://avatars.githubusercontent.com/u/177390705?v=4
framework: Anchor
program_address: rdr1DeFWkwG6nQfammDLTzRT6uW32t7yEHWCmcr49Df
categories:
- NFT
- Messaging

- name: decalls_prediction
description: DeCalls is the ultimate price prediction platform on Eclipse where anyone can wager on whether the price of an asset will rise or fall within a specific period with winners getting all the prize pool
repo: https://github.com/endlesstechjourney/decalls-public
icon: https://github.com/endlesstechjourney/decalls-public/blob/main/DeCalls_logo_white_high.png
framework: Anchor
program_address: DcZMKcjz34CcXF1vx7CkfARZdmEja2Kcwvspu1Zw6Zmn
categories:
- Dapp

- name: decalls_revshare
description: TDeCalls is the ultimate price prediction platform on Eclipse where anyone can wager on whether the price of an asset will rise or fall within a specific period with winners getting all the prize pool
repo: https://github.com/endlesstechjourney/decalls-public
icon: https://github.com/endlesstechjourney/decalls-public/blob/main/DeCalls_logo_white_high.png
framework: Anchor
program_address: ELexZoFHkSHYiAxw1jtY3se8RVPEjsL4HGqD4mfkMreZ
categories:
- Dapp

- name: Blobscriptions
description: Blobscription is a NFT Launchpad and Marketplace that provides infrastructure for a novel open Standard for NFTs and Inscriptions on Data Availability Layers
repo: https://github.com/blobscriptions/blobscriptions
icon: https://blobscriptions.xyz/blobscriptions-logo.png
framework: NextJS
program_address: ""
categories:
- NFT Marketplace
- Nft Launchpad
- Nft infra
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@
dependencies:
"@octokit/openapi-types" "^22.2.0"

argparse@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==

before-after-hook@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-3.0.2.tgz#d5665a5fa8b62294a5aa0a499f933f4a1016195d"
Expand All @@ -120,6 +125,13 @@ formdata-polyfill@^4.0.10:
dependencies:
fetch-blob "^3.1.2"

js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"

node-domexception@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
Expand Down
Loading