Skip to content

Commit

Permalink
feat: adds prettier run after updating orbit chains list
Browse files Browse the repository at this point in the history
  • Loading branch information
douglance committed Oct 21, 2024
1 parent 7fba894 commit bafcfd7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions packages/scripts/src/addOrbitChain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
updateAndValidateOrbitChainsList,
commitChangesAndCreatePR,
setOutputs,
runPrettier,
} from "./transforms";

/**
Expand Down Expand Up @@ -36,6 +37,8 @@ export async function addOrbitChain(targetJsonPath: string): Promise<void> {
targetJsonPath
);

await runPrettier(targetJsonPath);

await commitChangesAndCreatePR(
branchName,
targetJsonPath,
Expand Down
10 changes: 10 additions & 0 deletions packages/scripts/src/addOrbitChain/transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -430,3 +432,11 @@ export const updateOrbitChainsFile = (

return orbitChains;
};

export async function runPrettier(targetJsonPath: string): Promise<void> {
try {
await exec("yarn", ["prettier:format", targetJsonPath]);
} catch (error) {
warning(`Failed to run Prettier: ${error}`);
}
}
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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/[email protected]":
version "1.10.0"
resolved "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz"
Expand Down

0 comments on commit bafcfd7

Please sign in to comment.