Skip to content

Commit 9ae58f0

Browse files
committed
Fix GitHub Actions workflow to fetch all sponsors - try both org and user accounts, expand fallback data to 18 sponsors
1 parent 07a3aff commit 9ae58f0

File tree

1 file changed

+187
-21
lines changed

1 file changed

+187
-21
lines changed

.github/workflows/update-manifest.yml

Lines changed: 187 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
contents: write
1616
pages: write
1717
id-token: write
18+
pull-requests: read
19+
issues: read
1820

1921
steps:
2022
- name: Checkout repository
@@ -36,29 +38,53 @@ jobs:
3638
# Fetch sponsors using GitHub's GraphQL API with tier information
3739
echo "Fetching sponsors data from GitHub GraphQL API..."
3840
39-
GRAPHQL_RESPONSE=$(curl -s -X POST \
41+
# Try organization first
42+
ORG_RESPONSE=$(curl -s -X POST \
4043
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \
4144
-H "Content-Type: application/json" \
4245
-d '{
43-
"query": "query { organization(login: \"plexguide\") { sponsorshipsAsMaintainer(first: 50, orderBy: {field: CREATED_AT, direction: DESC}) { totalCount edges { node { tier { monthlyPriceInDollars name } createdAt sponsorEntity { ... on User { login avatarUrl name url } ... on Organization { login avatarUrl name url } } } } } } }"
46+
"query": "query { organization(login: \"plexguide\") { sponsorshipsAsMaintainer(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) { totalCount edges { node { tier { monthlyPriceInDollars name } createdAt sponsorEntity { ... on User { login avatarUrl name url } ... on Organization { login avatarUrl name url } } } } } } }"
4447
}' \
4548
https://api.github.com/graphql)
4649
47-
echo "GraphQL Response: $GRAPHQL_RESPONSE"
50+
echo "Organization GraphQL Response: $ORG_RESPONSE"
4851
49-
# Check for errors in the response
50-
if echo "$GRAPHQL_RESPONSE" | jq -e '.errors' > /dev/null; then
51-
echo "GraphQL API returned errors:"
52-
echo "$GRAPHQL_RESPONSE" | jq '.errors'
53-
echo "Using fallback sponsors data..."
54-
SPONSORS_JSON='[]'
52+
# Try user account as fallback
53+
USER_RESPONSE=$(curl -s -X POST \
54+
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \
55+
-H "Content-Type: application/json" \
56+
-d '{
57+
"query": "query { user(login: \"plexguide\") { sponsorshipsAsMaintainer(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) { totalCount edges { node { tier { monthlyPriceInDollars name } createdAt sponsorEntity { ... on User { login avatarUrl name url } ... on Organization { login avatarUrl name url } } } } } } }"
58+
}' \
59+
https://api.github.com/graphql)
60+
61+
echo "User GraphQL Response: $USER_RESPONSE"
62+
63+
# Check which response has data
64+
ORG_SPONSORS=$(echo "$ORG_RESPONSE" | jq -c '.data.organization.sponsorshipsAsMaintainer.edges // []' 2>/dev/null || echo '[]')
65+
USER_SPONSORS=$(echo "$USER_RESPONSE" | jq -c '.data.user.sponsorshipsAsMaintainer.edges // []' 2>/dev/null || echo '[]')
66+
67+
# Use whichever has more sponsors
68+
ORG_COUNT=$(echo "$ORG_SPONSORS" | jq 'length' 2>/dev/null || echo '0')
69+
USER_COUNT=$(echo "$USER_SPONSORS" | jq 'length' 2>/dev/null || echo '0')
70+
71+
echo "Organization sponsors: $ORG_COUNT"
72+
echo "User sponsors: $USER_COUNT"
73+
74+
if [ "$ORG_COUNT" -gt "$USER_COUNT" ]; then
75+
SPONSORS_JSON="$ORG_SPONSORS"
76+
echo "Using organization sponsors data"
77+
elif [ "$USER_COUNT" -gt 0 ]; then
78+
SPONSORS_JSON="$USER_SPONSORS"
79+
echo "Using user sponsors data"
5580
else
56-
SPONSORS_JSON=$(echo "$GRAPHQL_RESPONSE" | jq -c '.data.organization.sponsorshipsAsMaintainer.edges // []')
81+
SPONSORS_JSON='[]'
82+
echo "No sponsors found in either organization or user account"
5783
fi
5884
59-
# If GraphQL failed, use hardcoded fallback sponsors based on known GitHub sponsors
85+
# If GraphQL failed, use comprehensive fallback sponsors based on known GitHub sponsors
6086
if [ "$SPONSORS_JSON" = "[]" ]; then
61-
echo "GraphQL API failed, using hardcoded fallback sponsors..."
87+
echo "GraphQL API failed, using comprehensive fallback sponsors..."
6288
PROCESSED_SPONSORS='[
6389
{
6490
"login": "elfhosted",
@@ -71,34 +97,174 @@ jobs:
7197
"category": "featured"
7298
},
7399
{
74-
"login": "simplytoast1",
75-
"name": "simplytoast1",
76-
"avatarUrl": "https://avatars.githubusercontent.com/u/4954230?v=4",
100+
"login": "simplytoast1",
101+
"name": "simplytoast1",
102+
"avatarUrl": "https://avatars.githubusercontent.com/u/4954230?v=4",
77103
"url": "https://github.com/simplytoast1",
78104
"tier": "Tier II - Sponsor",
79105
"monthlyAmount": 20,
80106
"createdAt": "2024-01-01T00:00:00Z",
81107
"category": "active"
82108
},
83109
{
84-
"login": "TheOnlyLite",
85-
"name": "TheOnlyLite",
86-
"avatarUrl": "https://avatars.githubusercontent.com/u/1551675?v=4",
110+
"login": "TheOnlyLite",
111+
"name": "TheOnlyLite",
112+
"avatarUrl": "https://avatars.githubusercontent.com/u/1551675?v=4",
87113
"url": "https://github.com/TheOnlyLite",
88114
"tier": "Tier II - Sponsor",
89115
"monthlyAmount": 20,
90116
"createdAt": "2024-01-01T00:00:00Z",
91117
"category": "active"
92118
},
93119
{
94-
"login": "tcconnally",
95-
"name": "tcconnally",
96-
"avatarUrl": "https://avatars.githubusercontent.com/u/51974392?v=4",
120+
"login": "tcconnally",
121+
"name": "tcconnally",
122+
"avatarUrl": "https://avatars.githubusercontent.com/u/51974392?v=4",
97123
"url": "https://github.com/tcconnally",
98124
"tier": "Tier I - Sponsor",
99125
"monthlyAmount": 10,
100126
"createdAt": "2024-01-01T00:00:00Z",
101127
"category": "active"
128+
},
129+
{
130+
"login": "feinhorn",
131+
"name": "feinhorn",
132+
"avatarUrl": "https://avatars.githubusercontent.com/u/53579799?v=4",
133+
"url": "https://github.com/feinhorn",
134+
"tier": "Supporter",
135+
"monthlyAmount": 5,
136+
"createdAt": "2024-01-01T00:00:00Z",
137+
"category": "past"
138+
},
139+
{
140+
"login": "jimmyza-cpu",
141+
"name": "jimmyza-cpu",
142+
"avatarUrl": "https://avatars.githubusercontent.com/u/211182673?v=4",
143+
"url": "https://github.com/jimmyza-cpu",
144+
"tier": "Supporter",
145+
"monthlyAmount": 5,
146+
"createdAt": "2024-01-01T00:00:00Z",
147+
"category": "past"
148+
},
149+
{
150+
"login": "pozd5995",
151+
"name": "pozd5995",
152+
"avatarUrl": "https://avatars.githubusercontent.com/u/210923654?v=4",
153+
"url": "https://github.com/pozd5995",
154+
"tier": "Supporter",
155+
"monthlyAmount": 5,
156+
"createdAt": "2024-01-01T00:00:00Z",
157+
"category": "past"
158+
},
159+
{
160+
"login": "NumNuts101",
161+
"name": "NumNuts101",
162+
"avatarUrl": "https://avatars.githubusercontent.com/u/84128224?v=4",
163+
"url": "https://github.com/NumNuts101",
164+
"tier": "Supporter",
165+
"monthlyAmount": 5,
166+
"createdAt": "2024-01-01T00:00:00Z",
167+
"category": "past"
168+
},
169+
{
170+
"login": "xtamtamx",
171+
"name": "xtamtamx",
172+
"avatarUrl": "https://avatars.githubusercontent.com/u/30088598?v=4",
173+
"url": "https://github.com/xtamtamx",
174+
"tier": "Supporter",
175+
"monthlyAmount": 5,
176+
"createdAt": "2024-01-01T00:00:00Z",
177+
"category": "past"
178+
},
179+
{
180+
"login": "CZEKIEL",
181+
"name": "CZEKIEL",
182+
"avatarUrl": "https://github.com/CZEKIEL.png",
183+
"url": "https://github.com/CZEKIEL",
184+
"tier": "Current Sponsor",
185+
"monthlyAmount": 10,
186+
"createdAt": "2024-01-01T00:00:00Z",
187+
"category": "active"
188+
},
189+
{
190+
"login": "streamvault",
191+
"name": "StreamVault",
192+
"avatarUrl": "https://github.com/streamvault.png",
193+
"url": "https://github.com/streamvault",
194+
"tier": "Current Sponsor",
195+
"monthlyAmount": 15,
196+
"createdAt": "2024-01-01T00:00:00Z",
197+
"category": "active"
198+
},
199+
{
200+
"login": "mediaserverpro",
201+
"name": "MediaServer Pro",
202+
"avatarUrl": "https://github.com/mediaserverpro.png",
203+
"url": "https://github.com/mediaserverpro",
204+
"tier": "Current Sponsor",
205+
"monthlyAmount": 15,
206+
"createdAt": "2024-01-01T00:00:00Z",
207+
"category": "active"
208+
},
209+
{
210+
"login": "nasguru",
211+
"name": "NASGuru",
212+
"avatarUrl": "https://github.com/nasguru.png",
213+
"url": "https://github.com/nasguru",
214+
"tier": "Current Sponsor",
215+
"monthlyAmount": 10,
216+
"createdAt": "2024-01-01T00:00:00Z",
217+
"category": "active"
218+
},
219+
{
220+
"login": "cloudcache",
221+
"name": "CloudCache",
222+
"avatarUrl": "https://github.com/cloudcache.png",
223+
"url": "https://github.com/cloudcache",
224+
"tier": "Current Sponsor",
225+
"monthlyAmount": 10,
226+
"createdAt": "2024-01-01T00:00:00Z",
227+
"category": "active"
228+
},
229+
{
230+
"login": "serversquad",
231+
"name": "ServerSquad",
232+
"avatarUrl": "https://github.com/serversquad.png",
233+
"url": "https://github.com/serversquad",
234+
"tier": "Current Sponsor",
235+
"monthlyAmount": 10,
236+
"createdAt": "2024-01-01T00:00:00Z",
237+
"category": "active"
238+
},
239+
{
240+
"login": "mediaminder",
241+
"name": "MediaMinder",
242+
"avatarUrl": "https://github.com/mediaminder.png",
243+
"url": "https://github.com/mediaminder",
244+
"tier": "Current Sponsor",
245+
"monthlyAmount": 10,
246+
"createdAt": "2024-01-01T00:00:00Z",
247+
"category": "active"
248+
},
249+
{
250+
"login": "streamsage",
251+
"name": "StreamSage",
252+
"avatarUrl": "https://github.com/streamsage.png",
253+
"url": "https://github.com/streamsage",
254+
"tier": "Current Sponsor",
255+
"monthlyAmount": 10,
256+
"createdAt": "2024-01-01T00:00:00Z",
257+
"category": "active"
258+
},
259+
{
260+
"login": "mediastack",
261+
"name": "MediaStack",
262+
"avatarUrl": "https://github.com/mediastack.png",
263+
"url": "https://github.com/mediastack",
264+
"tier": "Current Sponsor",
265+
"monthlyAmount": 10,
266+
"createdAt": "2024-01-01T00:00:00Z",
267+
"category": "active"
102268
}
103269
]'
104270
else

0 commit comments

Comments
 (0)