[Agent] π Bounty T3: SolFoundry TypeScript SDK #3429
Workflow file for this run
This file contains hidden or 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: Wallet Check | |
| on: | |
| pull_request_target: | |
| types: [opened, edited] | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| check-wallet: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check for Solana wallet | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_BODY: ${{ github.event.pull_request.body }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| PR_AUTHOR: ${{ github.event.pull_request.user.login }} | |
| run: | | |
| python3 << 'PYEOF' | |
| import os, re, requests | |
| pr_body = os.environ.get("PR_BODY", "") | |
| pr_number = os.environ["PR_NUMBER"] | |
| pr_author = os.environ["PR_AUTHOR"] | |
| token = os.environ["GH_TOKEN"] | |
| repo = os.environ.get("GITHUB_REPOSITORY", "SolFoundry/solfoundry") | |
| patterns = [ | |
| r'\*\*Wallet:\*\*\s*`?([1-9A-HJ-NP-Za-km-z]{32,44})`?', | |
| r'[Ww]allet[:\s]+`?([1-9A-HJ-NP-Za-km-z]{32,44})`?', | |
| r'(?:^|\s)([1-9A-HJ-NP-Za-km-z]{43,44})(?:\s|$)', | |
| ] | |
| has_wallet = any(re.search(p, pr_body or "") for p in patterns) | |
| headers = {"Authorization": f"token {token}", "Accept": "application/vnd.github.v3+json"} | |
| if not has_wallet: | |
| comments_url = f"https://api.github.com/repos/{repo}/issues/{pr_number}/comments" | |
| comments = requests.get(comments_url, headers=headers).json() | |
| already_warned = any("Missing Solana Wallet" in (c.get("body", "") or "") for c in comments if isinstance(c, dict)) | |
| if not already_warned: | |
| body = ( | |
| f"β οΈ **Missing Solana Wallet**\n\n" | |
| f"Hey @{pr_author}! Your PR doesn't include a Solana wallet address.\n\n" | |
| f"**To receive your $FNDRY bounty payout, please edit your PR description and add your wallet:**\n\n" | |
| f"```\n**Wallet:** YOUR_SOLANA_ADDRESS_HERE\n```\n\n" | |
| f"Without a wallet, we can't send your bounty. " | |
| f"[Phantom](https://phantom.app) or [Backpack](https://backpack.app) are recommended.\n\n" | |
| f"---\n*SolFoundry Bounty Bot*" | |
| ) | |
| requests.post(comments_url, json={"body": body}, headers=headers) | |
| label_url = f"https://api.github.com/repos/{repo}/issues/{pr_number}/labels" | |
| requests.post(label_url, json={"labels": ["missing-wallet"]}, headers=headers) | |
| print(f"Warned PR #{pr_number} β no wallet found") | |
| else: | |
| print(f"Already warned PR #{pr_number}") | |
| else: | |
| print(f"Wallet found in PR #{pr_number}") | |
| label_url = f"https://api.github.com/repos/{repo}/issues/{pr_number}/labels/missing-wallet" | |
| requests.delete(label_url, headers=headers) | |
| PYEOF |