Skip to content

Lead — Fix

Lead — Fix #28

Workflow file for this run

name: Lead — Fix
on:
pull_request:
types: [labeled]
schedule:
- cron: '57 * * * *' # Hourly sweep for stale fix-needed PRs
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to fix'
required: false
concurrency:
group: lead-fix-${{ github.event.pull_request.number || inputs.pr_number || 'sweep' }}
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
issues: write
statuses: write
jobs:
fix:
if: >
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
github.event.label.name == 'status:fix-needed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref || '' }}
- name: Configure git
run: |
git config user.name "examples-bot"
git config user.email "noreply@deepgram.com"
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Get date
id: date
run: echo "date=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT
- name: Check fix attempt limit
id: attempts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUM="${{ github.event.pull_request.number || inputs.pr_number }}"
if [ -n "$PR_NUM" ]; then
FIXES=$(git log --oneline --author="examples-bot" 2>/dev/null | grep "^[a-f0-9]* fix(" | wc -l | tr -d ' ')
[ "$FIXES" -ge 3 ] && echo "max_reached=true" >> $GITHUB_OUTPUT \
|| echo "max_reached=false" >> $GITHUB_OUTPUT
[ "$FIXES" -ge 3 ] && gh pr comment "$PR_NUM" \
--body "@deepgram-devrel — fix agent made 3 attempts, still failing. Manual intervention needed."
else
echo "max_reached=false" >> $GITHUB_OUTPUT
fi
- name: Run instruction
if: steps.attempts.outputs.max_reached != 'true'
uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
mode: agent
model: claude-opus-4-6
allowed_tools: "Bash,Read,Write,Edit,Glob,Grep,WebSearch,WebFetch"
timeout_minutes: 30
direct_prompt: |
Read and execute instructions/lead-fix.md.
Context:
- PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }}
- Today's date: ${{ steps.date.outputs.date }}
- Repository: ${{ github.repository }}
- Trigger: ${{ github.event_name }}
env:
KAPA_API_KEY: ${{ secrets.KAPA_API_KEY }}
KAPA_PROJECT_ID: ${{ vars.KAPA_PROJECT_ID }}
DEEPGRAM_API_KEY: ${{ secrets.DEEPGRAM_API_KEY }}