Skip to content
Open
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
85 changes: 85 additions & 0 deletions integrations/github-action/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# SolFoundry GitHub Action

Automatically post bounties to [SolFoundry](https://solfoundry.vercel.app) when GitHub issues are labeled.

## Quick Start

```yaml
name: Post Bounty
on:
issues:
types: [labeled]

jobs:
bounty:
runs-on: ubuntu-latest
steps:
- uses: SolFoundry/solfoundry/integrations/github-action@main
with:
solfoundry-api-key: ${{ secrets.SOLFOUNDRY_API_KEY }}
```

## Inputs

| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `solfoundry-api-key` | ✅ | — | Your SolFoundry API key |
| `solfoundry-api-url` | ❌ | `https://solfoundry.vercel.app` | SolFoundry API base URL |
| `default-reward-amount` | ❌ | `100` | Default reward amount |
| `default-reward-token` | ❌ | `USDC` | Default reward token (`USDC` or `FNDRY`) |
| `default-tier` | ❌ | `T1` | Default bounty tier (`T1`, `T2`, `T3`) |
| `bounty-label` | ❌ | `bounty` | Label that triggers bounty creation |
| `github-token` | ❌ | `${{ github.token }}` | Token for posting comments |

## Outputs

| Output | Description |
|--------|-------------|
| `bounty-id` | ID of the created bounty |
| `bounty-url` | URL to the created bounty on SolFoundry |

## Label-Based Configuration

Override defaults using labels on the issue:

| Label | Effect |
|-------|--------|
| `bounty` | Triggers bounty creation (default label) |
| `bounty:$200` | Sets reward to 200 (default token) |
| `bounty:500FNDRY` | Sets reward to 500 FNDRY |
| `bounty-tier:T2` | Sets bounty tier to T2 |

### Examples

**Fixed reward per issue:**
```yaml
- uses: SolFoundry/solfoundry/integrations/github-action@main
with:
solfoundry-api-key: ${{ secrets.SOLFOUNDRY_API_KEY }}
default-reward-amount: '250'
default-reward-token: 'FNDRY'
default-tier: 'T2'
```

**Per-issue reward via labels:**
```yaml
- uses: SolFoundry/solfoundry/integrations/github-action@main
with:
solfoundry-api-key: ${{ secrets.SOLFOUNDRY_API_KEY }}
```
Then add labels like `bounty:$500` and `bounty-tier:T3` on each issue.

## Multi-Repo Setup

1. Create a SolFoundry API key at [solfoundry.vercel.app](https://solfoundry.vercel.app)
2. Add `SOLFOUNDRY_API_KEY` as a repository or organization secret
3. Copy the workflow file to each repo's `.github/workflows/` directory
4. Label issues with `bounty` to trigger automatic bounty creation

## How It Works

1. The action triggers on the `issues: labeled` event
2. It checks if the added label matches the configured `bounty-label`
3. It parses optional reward/tier overrides from other labels
4. It calls the SolFoundry API to create the bounty
5. It posts a comment on the issue with the bounty link
38 changes: 38 additions & 0 deletions integrations/github-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'SolFoundry Bounty Poster'
description: 'Automatically post bounties to SolFoundry when issues are labeled'
inputs:
solfoundry-api-key:
description: 'SolFoundry API key'
required: true
solfoundry-api-url:
description: 'SolFoundry API base URL'
required: false
default: 'https://solfoundry.vercel.app'
default-reward-amount:
description: 'Default reward amount'
required: false
default: '100'
default-reward-token:
description: 'Default reward token (USDC or FNDRY)'
required: false
default: 'USDC'
default-tier:
description: 'Default bounty tier (T1, T2, T3)'
required: false
default: 'T1'
bounty-label:
description: 'Label that triggers bounty creation'
required: false
default: 'bounty'
github-token:
description: 'GitHub token for posting comments'
required: false
default: '${{ github.token }}'
outputs:
bounty-id:
description: 'Created bounty ID'
bounty-url:
description: 'URL to the created bounty'
runs:
using: 'node20'
main: 'dist/index.js'
23 changes: 23 additions & 0 deletions integrations/github-action/examples/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: SolFoundry Bounty

on:
issues:
types: [labeled]

jobs:
post-bounty:
runs-on: ubuntu-latest
# Only run when the "bounty" label is added
if: github.event.label.name == 'bounty'
steps:
- name: Post bounty to SolFoundry
uses: SolFoundry/solfoundry/integrations/github-action@main
with:
solfoundry-api-key: ${{ secrets.SOLFOUNDRY_API_KEY }}
# Optional: customize defaults
# solfoundry-api-url: 'https://solfoundry.vercel.app'
# default-reward-amount: '100'
# default-reward-token: 'USDC'
# default-tier: 'T1'
# bounty-label: 'bounty'
github-token: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading