Skip to content

Commit

Permalink
renames and refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghel committed Feb 19, 2024
1 parent 8944013 commit 5716f51
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
10 changes: 6 additions & 4 deletions action/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -188117,10 +188117,10 @@ const robot = (app) => {
}
function getDistinctTokens(fileNames) {
const regex = /tokens\/(.*?).json/;
const accounts = fileNames
const tokens = fileNames
.map(x => regex.exec(x)?.at(1))
.filter(x => x);
return [...new Set(accounts)];
return [...new Set(tokens)];
}
async function fail(reason) {
await createComment(reason);
Expand Down Expand Up @@ -188260,10 +188260,12 @@ const robot = (app) => {
owners = await getIdentityOwners(changedFiles);
break;
case 'account':
owners = [...await getAccountOwner(asset)];
const accountOwner = await getAccountOwner(asset);
owners = [accountOwner];
break;
case 'token':
owners = [...await getTokenOwner(asset)];
const tokenOwner = await getTokenOwner(asset);
owners = [tokenOwner];
break;
default:
owners = [];
Expand Down
14 changes: 8 additions & 6 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const robot = (app: Probot) => {
}

async function getAccountOwner(account: string): Promise<string> {
const accountOwner = await getAccountOwnerFromApi(account);
const accountOwner = await getAccountOwnerFromApi(account);
if (new Address(accountOwner).isContractAddress()) {
return getAccountOwnerFromApi(accountOwner);
}
Expand Down Expand Up @@ -182,11 +182,11 @@ export const robot = (app: Probot) => {
function getDistinctTokens(fileNames: string[]) {
const regex = /tokens\/(.*?).json/;

const accounts = fileNames
const tokens = fileNames
.map(x => regex.exec(x)?.at(1))
.filter(x => x);

return [...new Set(accounts)];
return [...new Set(tokens)];
}

async function fail(reason: string) {
Expand Down Expand Up @@ -348,7 +348,7 @@ export const robot = (app: Probot) => {
}

const asset = distinctIdentities[0];
if(!asset) {
if (!asset) {
await fail('No asset update detected');
return;
}
Expand All @@ -360,10 +360,12 @@ export const robot = (app: Probot) => {
owners = await getIdentityOwners(changedFiles);
break;
case 'account':
owners = [...await getAccountOwner(asset)];
const accountOwner = await getAccountOwner(asset);
owners = [accountOwner];
break;
case 'token':
owners = [...await getTokenOwner(asset)];
const tokenOwner = await getTokenOwner(asset);
owners = [tokenOwner];
break;
default:
owners = [];
Expand Down

0 comments on commit 5716f51

Please sign in to comment.