Skip to content

Commit 4ea0044

Browse files
authored
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.
1 parent 514cb79 commit 4ea0044

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ outputs:
3232

3333
runs:
3434
using: 'docker'
35-
image: 'docker://ghcr.io/paritytech/review-bot/action:2.3.0'
35+
image: 'docker://ghcr.io/paritytech/review-bot/action:2.3.1'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "review-bot",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"description": "Have custom review rules for PRs with auto assignment",
55
"main": "src/index.ts",
66
"scripts": {

src/polkadot/fellows.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,23 @@ export class PolkadotFellows implements TeamApi {
4444
| Record<string, unknown>
4545
| undefined;
4646

47-
// If the identity is null, we ignore it.
47+
// If the identity is null, we check if there is a super identity.
4848
if (!fellowData) {
49-
this.logger.debug("Identity is null. Skipping");
49+
this.logger.debug("Identity is null. Checking for super identity");
50+
const superIdentity = (await api.query.identity.superOf(fellow.address)).toHuman() as
51+
| [string, { Raw: string }]
52+
| undefined;
53+
if (superIdentity && superIdentity[0]) {
54+
this.logger.debug(`${fellow.address} has a super identity: ${superIdentity[0]}. Adding it to the array`);
55+
fellows.push({ address: superIdentity[0], rank: fellow.rank });
56+
} else {
57+
this.logger.debug("No super identity found. Skipping");
58+
}
5059
continue;
5160
}
5261

5362
// @ts-ignore
54-
const additional = fellowData.info.additional as [{ Raw: string }, { Raw: string }][] | undefined;
63+
const additional = fellowData.info?.additional as [{ Raw: string }, { Raw: string }][] | undefined;
5564

5665
// If it does not have additional data (GitHub handle goes here) we ignore it
5766
if (!additional || additional.length < 1) {

0 commit comments

Comments
 (0)