Skip to content

Commit

Permalink
go to yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
dandlezzz committed Oct 14, 2024
1 parent cf3082f commit 013afab
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 133 deletions.
47 changes: 31 additions & 16 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,36 +28,51 @@ async function validateAndMerge() {
fetch: fetch,
},
});

try {
const { data: pr } = await octokit.pulls.get({
owner,
repo,
pull_number,
});

const { data: diff } = await octokit.pulls.get({
const { data: files } = await octokit.pulls.listFiles({
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 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 addedContent = JSON.parse(addedLines.join(''));
const { data: fileContent } = await octokit.repos.getContent({
owner,
repo,
path: yamlFile.filename,
ref: pr.head.ref,
});

const isValid = requiredKeys.every(key => key in addedContent);
const content = Buffer.from(fileContent.content, 'base64').toString('utf-8');

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

if (!isValid) {
console.log('Added object does not contain all required keys');
return;
}
for (const document of yamlDocuments) {
const isValid = requiredKeys.every(key => key in document);

if (!Array.isArray(addedContent.categories) || addedContent.categories.length === 0) {
console.log('Categories must be a non-empty array');
return;
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
117 changes: 0 additions & 117 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

0 comments on commit 013afab

Please sign in to comment.