A GitHub Action that generates AI-powered article suggestions from git diffs using the Brainfish API.
- uses: brainfish-ai/create-suggestions@v1
with:
api_key: ${{ secrets.BRAINFISH_API_KEY }}
name: Suggest articles
on:
pull_request:
types: [opened, synchronize]
jobs:
suggest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: brainfish-ai/create-suggestions@v1
with:
api_key: ${{ secrets.BRAINFISH_API_KEY }}
collection_id: "your-collection-uuid" # optionalname: Suggest articles
on:
push:
branches: [main]
jobs:
suggest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: brainfish-ai/create-suggestions@v1
with:
api_key: ${{ secrets.BRAINFISH_API_KEY }}
- uses: brainfish-ai/create-suggestions@v1
with:
api_key: ${{ secrets.BRAINFISH_API_KEY }}
base: "abc123"| Input | Required | Description |
|---|---|---|
api_key |
Yes | Brainfish public API key for authentication |
collection_id |
No | Collection ID to target for suggestions |
base |
No | Base commit SHA to generate the diff from |
api_url |
No | API base URL (default: https://api.brainfi.sh) |
| Output | Description |
|---|---|
task_id |
The task ID for the triggered suggestion pipeline |
status |
The status of the suggestion request |
- If
baseis provided, uses the diff betweenbaseandHEAD - If triggered by a pull request, uses the PR base branch SHA
- If triggered by a push, uses the
beforeSHA from the push event - Otherwise, falls back to
HEAD~1
Note: Always use
actions/checkoutwithfetch-depth: 0to ensure the full git history is available for diff generation.
MIT