Skip to content

Commit 1a120c9

Browse files
committed
Deploy Production Code for Commit dcb657f 🚀
1 parent dcb657f commit 1a120c9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/constants.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export interface Sponsor {
6767
name: string | null;
6868
login: string;
6969
url: string;
70-
avatarUrl: string;
70+
avatarUrl?: string;
7171
websiteUrl: string | null;
7272
};
7373
createdAt: string;

lib/template.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,12 @@ function getSponsors(action) {
4141
login
4242
url
4343
websiteUrl
44-
avatarUrl
4544
}
4645
... on User {
4746
name
4847
login
4948
url
5049
websiteUrl
51-
avatarUrl
5250
}
5351
}
5452
createdAt
@@ -144,7 +142,13 @@ function generateTemplate(response, action) {
144142
websiteUrl: (0, util_1.sanitizeAndClean)(sponsorEntity.websiteUrl || sponsorEntity.url),
145143
name: (0, util_1.sanitizeAndClean)(sponsorEntity.name || ''),
146144
login: (0, util_1.sanitizeAndClean)(sponsorEntity.login),
145+
/**
146+
* The avatar URL provided by the GitHub API includes an expiration token so we circumvent this for now
147+
* by using a path that is always available.
148+
*/
147149
avatarUrl: sponsorEntity.avatarUrl
150+
? sponsorEntity.avatarUrl
151+
: `https://github.com/${(0, util_1.sanitizeAndClean)(sponsorEntity.login)}.png`
148152
};
149153
/**
150154
* Ensure that the template is safe to render by preventing the usage of triple brackets.

0 commit comments

Comments
 (0)