Skip to content

Commit

Permalink
Mmackz/db plugin automation (#12)
Browse files Browse the repository at this point in the history
* delete test

* feat: add jojo stake plugin

* Chore: bump pnpm 8.15.3

* test

* Feat(zora): add simulateMint

* Feat(mirror): add simulateMint

* Feat(sound): add mintSimulate

* chore: format

* Chore: changeset

* Version Packages (alpha)

* add zod as a dev dependency

* add script

* add js-yaml

* update

* test

* commonjs

* things

* install types

* why not

* change

* logs

* drop catch

* set path

* add url to schema

* add test plugin

* chore: format

* update config

* add comment

* exit on error

* fill in details

* add check for new packages

* remove config

* add type notations

* branches

* target fork

* :(

* 1

* Feat(registry): add getTxSimulation to registry

* 2

* Chore: delete questk pnpm-workspace.yaml

* lfg

* types

* add details

* update message

* Fix: root tsconfig

* Fix: tweak root tsconfig

* chore: format

* Chore: changeset

* Chore: fully remove tsconfig from root

* update script

* Chore: remove per-app pnpm enforcement

* remove icon

* chore: version package (alpha)

* update

* update

* add details

* remove logs

* pass tests

* add branch

* test merge

* fix: delete TOKEN_JUSD

* Chore(utils): add sepolia to chain-ids

* Chore(types): make tokenId option for mint intent

* Fix(zora): update ABI, Save legacy mint in seperate ABI

* Feat(zora): add mint cop addresses

* Feat(utils): ADD TREASURY CONST

* Feat(zora): update intent/simulation with new contract

* Test(zora): simulation

* chore: format

* Chore: cleanup

* chore: format

* Fix: update simulation return types

* added export for tokens directory

* chore: format

* chore: format

* added changeset

* Test(zora): remove only

* Test(zora): update test data

* Chore(deps): bump codecov/codecov-action from 4.0.1 to 4.1.0

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.0.1 to 4.1.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v4.0.1...v4.1.0)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Refactor(zora): use viem pad over helper

Thanks for the tip @jonathandiep

* Chore(zora): remove stray log

* Chore: changeset

* refactor(jojo): remove template comments

* refactor(jojo): convert bigint to string value

* chore: version package (alpha)

* Fix(zora): remove extra msgArgs

* chore: version package (alpha)

* validateicon

* update action

* use ngrok for testing

* Fix config file format verification script

* update iconoption

* change ngrok url

* fix logo url

* fix logo url

* verify unique urls

* add env override

* add script to register plugin details

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: almo <[email protected]>
Co-authored-by: Quazia <[email protected]>
Co-authored-by: Quazia <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: mmackz <[email protected]>
Co-authored-by: veganbeef <[email protected]>
Co-authored-by: veganbeef <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
9 people authored Mar 1, 2024
1 parent e8b94a0 commit da3472b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 15 deletions.
32 changes: 30 additions & 2 deletions .github/scripts/registerNewPlugins.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
console.log('gm')
process.exit(1)
async function sendPluginDetailsToAPI(detailsPath: string): Promise<void> {
try {
const fileContents = await fs.readFile(detailsPath, "utf8");
const details = yaml.load(fileContents);

const { project, task } = details;

// send details to staging API
const stagingApiUrl = process.env.STAGING_API_URL;
const { projectId: stagingProjectId } = await axios.post(`${stagingApiUrl}/plugins/add-project`, {
...project,
approvedForTerminal: true,
});
await axios.post(`${stagingApiUrl}/plugins/add-task`, {
...task,
projectId: stagingProjectId,
approvedForTerminal: true
});

// send details to production API
const productionApiUrl = process.env.PRODUCTION_API_URL;
const { projectId } = await axios.post(`${productionApiUrl}/plugins/add-project`, project);
await axios.post(`${productionApiUrl}/plugins/add-task`, {
...task,
projectId,
});
} catch (error) {
throw new Error(`Error sending plugin details to API: ${error}`);
}
}
11 changes: 7 additions & 4 deletions .github/scripts/verifyConfigFileFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ async function validateConfigFile(filePath: string): Promise<void> {
const configFileContent = await fs.readFile(filePath, "utf8");
const config = yaml.load(configFileContent);
PluginConfigSchema.parse(config);
if (config.project.iconOption) {
await validateIcon(config.project.iconOption);
const { project, task } = config;

// validate each unique icon option url
const uniqueIconOptions = new Set([project.iconOption, task.iconOption].filter(Boolean));
for (const iconOption of uniqueIconOptions) {
await validateIcon(iconOption);
}
await validateIcon(config.task.iconOption);
console.log(`Config in ${filePath} is valid.`);
} catch (error) {
console.error(`Error validating config in ${filePath}:`, error);
Expand All @@ -97,7 +100,7 @@ async function validateConfigFile(filePath: string): Promise<void> {

async function validateIcon(iconUrl: string) {
const response = await axios.post(
"http://localhost:5000/plugins/validate-icon",
`${process.env.APP_URL}/plugins/validate-icon`,
{
iconOption: iconUrl,
},
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ jobs:

- name: Run config file format verification script
run: npx ts-node ./.github/scripts/verifyConfigFileFormat.ts
env:
APP_URL: https://01e0-70-67-36-90.ngrok-free.app
16 changes: 9 additions & 7 deletions .github/workflows/on-push-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ jobs:
run: pnpm install && pnpm install node-fetch

- name: Call API to register new plugins with retry logic
run: npx ts-node ./.github/scripts/registerNewPlugins.ts
# run: |
# for attempt in {1..3}; do
# npx ts-node ./.github/scripts/registerNewPlugins.ts && break
# echo "Attempt $attempt failed. Retrying in 5 seconds..."
# sleep 5
# done
run: |
for attempt in {1..3}; do
npx ts-node ./.github/scripts/registerNewPlugins.ts && break
echo "Attempt $attempt failed. Retrying in 5 seconds..."
sleep 5
done
env:
STAGING_API_URL: https://01e0-70-67-36-90.ngrok-free.app
PRODUCTION_API_URL: https://01e0-70-67-36-90.ngrok-free.app

# release:
# name: Release
Expand Down
4 changes: 2 additions & 2 deletions packages/apples/plugin-details.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Please fill in the details
project:
name: Apples
iconOption: https://apples.com/icon.png
iconOption: https://cryptologos.cc/logos/bitcoin-btc-logo.png?v=029
appLink: https://apples.com

task:
# action specific name, this is what will show as the default title for your boosts
name: Mint on Apples
# action specific link to your project. (ie: myapp.com/swap)
link: https://apples.com/mint
iconOption: https://apples.com/icon.png
iconOption: https://cryptologos.cc/logos/bitcoin-btc-logo.png?v=029
actionPluginId: mint

0 comments on commit da3472b

Please sign in to comment.