Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/ask_sponsor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Ask Sponsor
on:
pull_request_target:
types:
- opened
jobs:
ask_sponsor:
uses: ./.github/workflows/wc_ask_sponsor.yaml
permissions: {}
with:
author: ${{github.event.pull_request.user.login}}
pr_number: ${{github.event.pull_request.number}}
if: |
github.event.pull_request.user.type == 'User'
# if: |
# github.event.pull_request.user.type == 'User' &&
# github.event.pull_request.user.login != 'suzuki-shunsuke'
69 changes: 69 additions & 0 deletions .github/workflows/wc_ask_sponsor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
on:
workflow_dispatch:
inputs:
author:
required: true
pr_number:
required: true
workflow_call:
inputs:
author:
type: string
required: true
pr_number:
type: string
required: true
jobs:
ask_sponsor:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions: {}
steps:
- env:
GH_TOKEN: ${{github.token}}
AUTHOR: ${{inputs.author}}
PR_NUMBER: ${{inputs.pr_number}}
BODY: |
We spend a lot of time maintaining aqua and aqua-registry every day.
Today, aqua-registry is used not only by aqua, but also by tools like mise and docker agent.
If these projects help you, please consider supporting us via GitHub Sponsors.
https://github.com/sponsors/aquaproj
run: |
set -eu

is_sponsor=$(gh api graphql \
-F "sponsorable=aquaproj" \
-F "author=$AUTHOR" \
-q '.data.user.isSponsoredBy' \
-f query='
query($sponsorable: String!, $author: String!) {
user(login: $sponsorable) {
isSponsoredBy(accountLogin: $author)
}
}')
if [ "$is_sponsor" = "true" ]; then
echo "::notice:: @$AUTHOR is a sponsor of aquaproj"
exit 0
fi

is_sponsor=$(gh api graphql \
-F "sponsorable=suzuki-shunsuke" \
-F "author=$AUTHOR" \
-q '.data.user.isSponsoredBy' \
-f query='
query($sponsorable: String!, $author: String!) {
user(login: $sponsorable) {
isSponsoredBy(accountLogin: $author)
}
}')
if [ "$is_sponsor" = "true" ]; then
echo "::notice:: @$AUTHOR is a sponsor of suzuki-shunsuke"
exit 0
fi

echo "::notice:: @$AUTHOR is NOT a (public) sponsor of aquaproj or suzuki-shunsuke"
gh pr comment \
-R "$GITHUB_REPOSITORY" \
--body "$BODY" \
"$PR_NUMBER"