Skip to content

Commit bc7f596

Browse files
committed
Add the GH Sponsors fetch to the website test too.
1 parent 7edb415 commit bc7f596

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/pullrequest.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,27 @@ jobs:
2626
- name: Clone Repository
2727
uses: actions/checkout@v4
2828

29+
- name: Fetch GH Sponsors
30+
env:
31+
GH_TOKEN: ${{ secrets.SPONSORS_TOKEN }}
32+
GH_LOGIN: your-org
33+
run: |
34+
QUERY='query($login:String!){
35+
organization(login:$login){
36+
monthlyEstimatedSponsorsIncomeInCents
37+
sponsorshipsAsMaintainer(first:1){ totalCount }
38+
}
39+
}'
40+
RESP=$(curl -s https://api.github.com/graphql \
41+
-H "Authorization: Bearer $GH_TOKEN" \
42+
-H "Content-Type: application/json" \
43+
-d "{\"query\":\"$QUERY\",\"variables\":{\"login\":\"$GH_LOGIN\"}}")
44+
CENTS=$(echo "$RESP" | jq '.data.organization.monthlyEstimatedSponsorsIncomeInCents // 0')
45+
COUNT=$(echo "$RESP" | jq '.data.organization.sponsorshipsAsMaintainer.totalCount // 0')
46+
jq -n --argjson sum "$CENTS" --argjson count "$COUNT" \
47+
'{ sponsor_sum: ($sum/100|floor), sponsor_count: $count }' \
48+
> website/_data/gh_sponsors.json
49+
2950
- name: Setup .NET Core SDK
3051
uses: actions/setup-dotnet@v4
3152
with:

0 commit comments

Comments
 (0)