Skip to content

Commit

Permalink
Fellows: Added search of super identity (#108)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Bullrich authored Jan 3, 2024
1 parent 514cb79 commit 4ea0044
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
15 changes: 12 additions & 3 deletions src/polkadot/fellows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,23 @@ export class PolkadotFellows implements TeamApi {
| Record<string, unknown>
| 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) {
Expand Down

0 comments on commit 4ea0044

Please sign in to comment.