From 4ea00441b921cfdbbd47dcd95f1f6e3e0ab0b691 Mon Sep 17 00:00:00 2001 From: Javier Bullrich Date: Wed, 3 Jan 2024 15:48:45 -0300 Subject: [PATCH] Fellows: Added search of super identity (#108) Added logic to search for a super identity in case that the user does not have an identity. If a super identity is found, this will be added to the array of address to fetch an identity from. This fixes #107 Updated version to `2.3.1` as this is a small patch. --- action.yml | 2 +- package.json | 2 +- src/polkadot/fellows.ts | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index b6abce8..e75b43d 100644 --- a/action.yml +++ b/action.yml @@ -32,4 +32,4 @@ outputs: runs: using: 'docker' - image: 'docker://ghcr.io/paritytech/review-bot/action:2.3.0' + image: 'docker://ghcr.io/paritytech/review-bot/action:2.3.1' diff --git a/package.json b/package.json index 82f640b..d999854 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "review-bot", - "version": "2.3.0", + "version": "2.3.1", "description": "Have custom review rules for PRs with auto assignment", "main": "src/index.ts", "scripts": { diff --git a/src/polkadot/fellows.ts b/src/polkadot/fellows.ts index 9ed1896..81b5fd7 100644 --- a/src/polkadot/fellows.ts +++ b/src/polkadot/fellows.ts @@ -44,14 +44,23 @@ export class PolkadotFellows implements TeamApi { | Record | undefined; - // If the identity is null, we ignore it. + // If the identity is null, we check if there is a super identity. if (!fellowData) { - this.logger.debug("Identity is null. Skipping"); + this.logger.debug("Identity is null. Checking for super identity"); + const superIdentity = (await api.query.identity.superOf(fellow.address)).toHuman() as + | [string, { Raw: string }] + | undefined; + if (superIdentity && superIdentity[0]) { + this.logger.debug(`${fellow.address} has a super identity: ${superIdentity[0]}. Adding it to the array`); + fellows.push({ address: superIdentity[0], rank: fellow.rank }); + } else { + this.logger.debug("No super identity found. Skipping"); + } continue; } // @ts-ignore - const additional = fellowData.info.additional as [{ Raw: string }, { Raw: string }][] | undefined; + const additional = fellowData.info?.additional as [{ Raw: string }, { Raw: string }][] | undefined; // If it does not have additional data (GitHub handle goes here) we ignore it if (!additional || additional.length < 1) {