diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 0c53feef3e..c6d9c1298e 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -25,6 +25,7 @@ "zod": "^3.23.8" }, "devDependencies": { + "@actions/exec": "^1.1.1", "@types/node": "^22.7.1", "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.0.0", diff --git a/packages/scripts/src/addOrbitChain/index.ts b/packages/scripts/src/addOrbitChain/index.ts index 64d66647f0..13ce85c114 100644 --- a/packages/scripts/src/addOrbitChain/index.ts +++ b/packages/scripts/src/addOrbitChain/index.ts @@ -8,6 +8,7 @@ import { updateAndValidateOrbitChainsList, commitChangesAndCreatePR, setOutputs, + runPrettier, } from "./transforms"; /** @@ -36,6 +37,8 @@ export async function addOrbitChain(targetJsonPath: string): Promise { targetJsonPath ); + await runPrettier(targetJsonPath); + await commitChangesAndCreatePR( branchName, targetJsonPath, diff --git a/packages/scripts/src/addOrbitChain/transforms.ts b/packages/scripts/src/addOrbitChain/transforms.ts index e34dbf45a2..4486c6f26f 100644 --- a/packages/scripts/src/addOrbitChain/transforms.ts +++ b/packages/scripts/src/addOrbitChain/transforms.ts @@ -6,6 +6,8 @@ import { warning } from "@actions/core"; import axios from "axios"; import * as fs from "fs"; import sharp from "sharp"; +// @ts-expect-error - @actions/exec is not typed +import { exec } from "@actions/exec"; import { commitChanges, @@ -430,3 +432,11 @@ export const updateOrbitChainsFile = ( return orbitChains; }; + +export async function runPrettier(targetJsonPath: string): Promise { + try { + await exec("yarn", ["prettier:format", targetJsonPath]); + } catch (error) { + warning(`Failed to run Prettier: ${error}`); + } +} diff --git a/yarn.lock b/yarn.lock index 30f2747718..9b513558fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,6 +10,13 @@ "@actions/http-client" "^2.0.1" uuid "^8.3.2" +"@actions/exec@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@actions/exec/-/exec-1.1.1.tgz#2e43f28c54022537172819a7cf886c844221a611" + integrity sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w== + dependencies: + "@actions/io" "^1.0.1" + "@actions/github@^6.0.0": version "6.0.0" resolved "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz" @@ -28,6 +35,11 @@ tunnel "^0.0.6" undici "^5.25.4" +"@actions/io@^1.0.1": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.1.3.tgz#4cdb6254da7962b07473ff5c335f3da485d94d71" + integrity sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q== + "@adraffy/ens-normalize@1.10.0": version "1.10.0" resolved "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz"