Skip to content

Commit 9f908fc

Browse files
authored
Don't run check-token-list unless the token JSON files changed (#3304)
* dont run check-token-list unless the file changed * move token list into its own file * testing condition * test * oops * ok this should work * omg * d * im straight up gonna cry * bite me * dorny? * test * update to v4 of checkout and setup-node * :D * test * test * fixy * final test * always run this job on development branch * dont fetch foreign address for unconfigured chains
1 parent a4a53b2 commit 9f908fc

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

.github/workflows/build.yml

+21-11
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v3
18-
- uses: actions/setup-node@v3
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
1919
with:
2020
node-version: 20
2121
cache: "npm"
@@ -30,8 +30,8 @@ jobs:
3030
runs-on: ubuntu-latest
3131

3232
steps:
33-
- uses: actions/checkout@v3
34-
- uses: actions/setup-node@v3
33+
- uses: actions/checkout@v4
34+
- uses: actions/setup-node@v4
3535
with:
3636
node-version: 20
3737
cache: "npm"
@@ -55,24 +55,34 @@ jobs:
5555

5656
check-token-list:
5757
runs-on: ubuntu-latest
58-
5958
steps:
60-
- uses: actions/checkout@v3
61-
- uses: actions/setup-node@v3
59+
- uses: actions/checkout@v4
60+
- uses: dorny/paths-filter@v3
61+
id: filter
62+
with:
63+
filters: |
64+
tokens:
65+
- 'wormhole-connect/src/config/mainnet/wrappedTokens.ts'
66+
- 'wormhole-connect/src/config/testnet/wrappedTokens.ts'
67+
- uses: actions/setup-node@v4
68+
if: steps.filter.outputs.tokens == 'true' || github.ref == 'refs/heads/development'
6269
with:
6370
node-version: 20
6471
cache: "npm"
6572
cache-dependency-path: "wormhole-connect/package-lock.json"
6673
- run: npm ci
74+
if: steps.filter.outputs.tokens == 'true' || github.ref == 'refs/heads/development'
6775
working-directory: wormhole-connect
6876
- run: npm run checkForeignAssets
77+
if: steps.filter.outputs.tokens == 'true' || github.ref == 'refs/heads/development'
6978
working-directory: wormhole-connect
79+
7080
build-hosted:
7181
runs-on: ubuntu-latest
7282

7383
steps:
74-
- uses: actions/checkout@v3
75-
- uses: actions/setup-node@v3
84+
- uses: actions/checkout@v4
85+
- uses: actions/setup-node@v4
7686
with:
7787
node-version: 20
7888
cache: "npm"
@@ -85,8 +95,8 @@ jobs:
8595
runs-on: ubuntu-latest
8696

8797
steps:
88-
- uses: actions/checkout@v3
89-
- uses: actions/setup-node@v3
98+
- uses: actions/checkout@v4
99+
- uses: actions/setup-node@v4
90100
with:
91101
node-version: 20
92102
cache: "npm"

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,3 @@ This SDK is an open source software SDK that leverages the Wormhole protocol, a
253253

254254
Wormhole Connect is an NPM package that interacts with the Wormhole protocol. You assume all risks associated with using the SDK, the Wormhole Connect NPM package, the Wormhole protocol, and digital assets and decentralized systems generally, including but not limited to, that: (a) digital assets are highly volatile; (b) using digital assets is inherently risky due to both features of such assets and the potential unauthorized acts of third parties; (c) you may not have ready access to assets; and (d) you may lose some or all of your tokens or other assets. You agree that you will have no recourse against anyone else for any losses due to the use of the SDK or Wormhole. For example, these losses may arise from or relate to: (i) incorrect information; (ii) software or network failures; (iii) corrupted cryptocurrency wallet files; (iv) unauthorized access; (v) errors, mistakes, or inaccuracies; or (vi) third-party activities.
255255

256-

wormhole-connect/scripts/checkForeignAssetsConfig.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ const checkEnvConfig = async (
8686

8787
const configForeignAddress =
8888
wrappedTokens[tokenId.chain]?.[tokenId.address]?.[chain];
89+
90+
if (!configForeignAddress) {
91+
// Skip chain for which there is no foreign asset configured
92+
// Connect can fetch them dynamically at runtime anyway
93+
return;
94+
}
95+
8996
if (chain === tokenId.chain) {
9097
if (configForeignAddress) {
9198
throw new Error(
@@ -120,7 +127,9 @@ const checkEnvConfig = async (
120127
`❌ Invalid foreign address detected! Env: ${env}, Token ${tokenId.chain} ${tokenId.address}, Chain: ${chain}, Expected: ${foreignAddress}, Received: ${configForeignAddress}`,
121128
);
122129
} else {
123-
console.log('✅ Config matches');
130+
console.log(
131+
`✅ ${tokenId.chain} ${tokenId.address} on ${chain} is correctly set to ${foreignAddress}`,
132+
);
124133
}
125134
} else {
126135
if (!recommendedUpdates[tokenId.chain]) {

0 commit comments

Comments
 (0)