Skip to content

Commit

Permalink
fix token update use case
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-rosianu committed Mar 29, 2024
1 parent ed2d2f9 commit 29c2644
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions action/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -188167,8 +188167,12 @@ const robot = (app) => {
return;
}
const tokensDirectories = (response.data && response.data.length) ? response.data : [];
const subdirectories = tokensDirectories.filter((content) => content?.type === "dir" && content?.name?.startsWith(tokenTicker));
if (subdirectories.length) {
const subdirectoriesWithSameTicker = tokensDirectories.filter((content) => content?.type === "dir" && content?.name?.startsWith(tokenTicker));
if (subdirectoriesWithSameTicker.length) {
if (subdirectoriesWithSameTicker[0].name === tokenName) {
// it's just an update to the same token
return;
}
await fail(`Token with ticker ${tokenTicker} already exists!`);
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,16 @@ export const robot = (app: Probot) => {
return;
}
const tokensDirectories = (response.data && (response.data as any[]).length) ? response.data as any[] : [];
const subdirectories = tokensDirectories.filter(
const subdirectoriesWithSameTicker = tokensDirectories.filter(
(content) => content?.type === "dir" && content?.name?.startsWith(tokenTicker),
);

if (subdirectories.length) {
if (subdirectoriesWithSameTicker.length) {
if (subdirectoriesWithSameTicker[0].name === tokenName) {
// it's just an update to the same token
return;
}

await fail(`Token with ticker ${tokenTicker} already exists!`);
}
}
Expand Down

0 comments on commit 29c2644

Please sign in to comment.