Skip to content

Add GH Sponsors to Donation page #167

Add GH Sponsors to Donation page

Add GH Sponsors to Donation page #167

Workflow file for this run

name: Test Build Website
on:
pull_request:
branches:
- 'main'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
test:
runs-on: ubuntu-latest
concurrency: ci-${{ github.ref }}
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Fetch GH Sponsors
env:
GH_TOKEN: ${{ secrets.SPONSORS_TOKEN }}
GH_LOGIN: your-org
run: |
QUERY='query($login:String!){
organization(login:$login){
monthlyEstimatedSponsorsIncomeInCents
sponsorshipsAsMaintainer(first:1){ totalCount }
}
}'
RESP=$(curl -s https://api.github.com/graphql \
-H "Authorization: Bearer $GH_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"query\":\"$QUERY\",\"variables\":{\"login\":\"$GH_LOGIN\"}}")
CENTS=$(echo "$RESP" | jq '.data.organization.monthlyEstimatedSponsorsIncomeInCents // 0')
COUNT=$(echo "$RESP" | jq '.data.organization.sponsorshipsAsMaintainer.totalCount // 0')
jq -n --argjson sum "$CENTS" --argjson count "$COUNT" \
'{ sponsor_sum: ($sum/100|floor), sponsor_count: $count }' \
> website/_data/gh_sponsors.json
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Build fxccs
run: dotnet build fxccs/fxccs.csproj
- name: Restore NPM Packages
run: npm install
- name: Build Site
run: npm run build
complete:
runs-on: ubuntu-latest
needs: test
name: Test completion task
steps:
- run: echo "Tests Complete"