From 7c1b4b25cd2d65d6d0c16c296ee57c0e00ca84e2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 14 Oct 2024 12:41:17 -0700 Subject: [PATCH 1/5] add test program --- programs.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/programs.json b/programs.json index f293d90..aff771a 100644 --- a/programs.json +++ b/programs.json @@ -101,6 +101,17 @@ "Nft Launchpad", "Nft infra" ] + }, + { + "name": "A TEST PROGRAM", + "description": "testin", + "repo": "test.com", + "icon": "test", + "framework": "Anchor", + "program_address": "t3stfEjtujQTWBXZVzgkiPBw7Mt4guHSsmAi7y3cycL", + "categories": [ + "DEX" + ] } ] \ No newline at end of file From dd05b5def2a349a056cdfa5f74ba964c61393926 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 14 Oct 2024 12:48:46 -0700 Subject: [PATCH 2/5] remove json validation --- .github/scripts/validate-and-merge.mjs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/scripts/validate-and-merge.mjs b/.github/scripts/validate-and-merge.mjs index f230bd3..f9d3e28 100644 --- a/.github/scripts/validate-and-merge.mjs +++ b/.github/scripts/validate-and-merge.mjs @@ -46,22 +46,6 @@ async function validateAndMerge() { console.log('PR does not modify only the target JSON file'); return; } - - const { data: fileContent } = await octokit.repos.getContent({ - owner, - repo, - path: jsonFile.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, From cf3082f3dbe393eece3347debdbf3d36f95c3876 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 14 Oct 2024 12:50:35 -0700 Subject: [PATCH 3/5] relax rules --- .github/scripts/validate-and-merge.mjs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/scripts/validate-and-merge.mjs b/.github/scripts/validate-and-merge.mjs index f9d3e28..aa334a5 100644 --- a/.github/scripts/validate-and-merge.mjs +++ b/.github/scripts/validate-and-merge.mjs @@ -35,17 +35,6 @@ async function validateAndMerge() { pull_number, }); - const { data: files } = await octokit.pulls.listFiles({ - owner, - repo, - 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'); - return; - } const { data: diff } = await octokit.pulls.get({ owner, repo, From 013afab4e998c05f88af0997b9210a42c041b6a3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 14 Oct 2024 12:59:20 -0700 Subject: [PATCH 4/5] go to yaml --- .github/scripts/validate-and-merge.mjs | 47 ++++++---- programs.json | 117 ------------------------- programs.yaml | 84 ++++++++++++++++++ 3 files changed, 115 insertions(+), 133 deletions(-) delete mode 100644 programs.json create mode 100644 programs.yaml diff --git a/.github/scripts/validate-and-merge.mjs b/.github/scripts/validate-and-merge.mjs index aa334a5..2b809ae 100644 --- a/.github/scripts/validate-and-merge.mjs +++ b/.github/scripts/validate-and-merge.mjs @@ -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; @@ -28,6 +28,7 @@ async function validateAndMerge() { fetch: fetch, }, }); + try { const { data: pr } = await octokit.pulls.get({ owner, @@ -35,29 +36,43 @@ async function validateAndMerge() { 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({ diff --git a/programs.json b/programs.json deleted file mode 100644 index aff771a..0000000 --- a/programs.json +++ /dev/null @@ -1,117 +0,0 @@ -[ - { - "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" - ] - }, - { - "name": "A TEST PROGRAM", - "description": "testin", - "repo": "test.com", - "icon": "test", - "framework": "Anchor", - "program_address": "t3stfEjtujQTWBXZVzgkiPBw7Mt4guHSsmAi7y3cycL", - "categories": [ - "DEX" - ] - } - -] \ No newline at end of file diff --git a/programs.yaml b/programs.yaml new file mode 100644 index 0000000..2052f26 --- /dev/null +++ b/programs.yaml @@ -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 From e2afc7471c8a47f38695802056f4ee18ee503d3c Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 14 Oct 2024 13:03:50 -0700 Subject: [PATCH 5/5] add js-yaml --- package.json | 1 + yarn.lock | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/package.json b/package.json index 188e721..890604f 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "type": "module", "dependencies": { "@octokit/rest": "^21.0.2", + "js-yaml": "^4.1.0", "node-fetch": "^3.3.2" } } diff --git a/yarn.lock b/yarn.lock index a67bb84..1000875 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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"