⬆️ Bump files with dotnet-file sync #467
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: sponsor 💜 | |
on: | |
issues: | |
types: [opened, edited, reopened] | |
pull_request: | |
types: [opened, edited, synchronize, reopened] | |
jobs: | |
sponsor: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
if: ${{ !endsWith(github.event.sender.login, '[bot]') && github.event.sender.login != github.repository_owner }} | |
steps: | |
- name: 🤘 checkout | |
uses: actions/checkout@v4 | |
- name: ⚙ install | |
run: dotnet tool update -g dotnet-sponsor --prerelease | |
- name: 💻 setup | |
run: | | |
sponsor --version | |
pushd ~ | |
git config -f .sponsorlink/.netconfig sponsorlink.id devlooped.sponsors.ci | |
- name: 🧪 run | |
shell: pwsh | |
env: | |
SPONSORABLE: ${{ secrets.GITHUB_TOKEN }} | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
$env:TOKEN | sponsor sync $env:SPONSORABLE --tos --with-token | |
if ($LASTEXITCODE -eq -5) { | |
throw "Can not determine sponsorship with the provided token" | |
} elseif ($LASTEXITCODE -eq -6) { | |
Write-Output "User is not sponsoring, skipping" | |
exit 0 | |
} elseif ($LASTEXITCODE -eq -3) { | |
Write-Output "$env:SPONSORABLE is not set up for SponsorLink" | |
exit 0 | |
} elseif ($LASTEXITCODE -eq -4) { | |
Write-Output "$env:SPONSORABLE SponsorLink manifest is invalid" | |
exit 0 | |
} elseif ($LASTEXITCODE -ne -0) { | |
Write-Output "Could not determine sponsor status" | |
exit $LASTEXITCODE | |
} | |
$roles = cat ~/.sponsorlink/github/$env:SPONSORABLE.jwt | jq -R 'split(".") | .[1] | @base64d | fromjson | .roles[]' | |
if (($roles | jq 'select(. == "team")' -r) -eq "team") { | |
Write-Output "User is a team member, skipping" | |
exit 0 | |
} elseif (($roles | jq 'select(. == "contrib")' -r) -eq "contrib") { | |
Write-Output "User is a contributor!" | |
} else { | |
Write-Output "User is a sponsor" | |
if (($roles | jq 'select(. == "org")' -r) -eq "org") { | |
Write-Output " (indirectly as a sponsoring organization member)" | |
} elseif (($roles | jq 'select(. == "user")' -r) -eq "user") { | |
Write-Output " (as a direct sponsor)" | |
} | |
} | |
- name: 💜 sponsor | |
if: env.token != '' | |
uses: devlooped/actions-sponsor@main | |
with: | |
token: ${{ env.token }} |