|
| 1 | +name: Create Example |
| 2 | + |
| 3 | +on: |
| 4 | + issues: |
| 5 | + types: [opened, labeled] |
| 6 | + schedule: |
| 7 | + - cron: '30 9 * * *' # Daily 09:30 UTC — drain the queue |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + integration: |
| 11 | + description: 'Integration to build (e.g. "Twilio Voice + Node.js")' |
| 12 | + required: false |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: create-example |
| 16 | + cancel-in-progress: false |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: write |
| 20 | + pull-requests: write |
| 21 | + issues: write |
| 22 | + |
| 23 | +jobs: |
| 24 | + # Only run for issues with the right label (on issue events) |
| 25 | + check: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + outputs: |
| 28 | + should_run: ${{ steps.check.outputs.should_run }} |
| 29 | + steps: |
| 30 | + - name: Check trigger |
| 31 | + id: check |
| 32 | + run: | |
| 33 | + EVENT="${{ github.event_name }}" |
| 34 | + LABEL="${{ github.event.label.name }}" |
| 35 | + ISSUE_LABEL=$(echo '${{ toJSON(github.event.issue.labels) }}' | jq -r '.[].name' | grep -c "queue:new-example" || true) |
| 36 | +
|
| 37 | + if [ "$EVENT" = "schedule" ] || [ "$EVENT" = "workflow_dispatch" ]; then |
| 38 | + echo "should_run=true" >> $GITHUB_OUTPUT |
| 39 | + elif [ "$EVENT" = "issues" ] && [ "$ISSUE_LABEL" -gt 0 ]; then |
| 40 | + echo "should_run=true" >> $GITHUB_OUTPUT |
| 41 | + else |
| 42 | + echo "should_run=false" >> $GITHUB_OUTPUT |
| 43 | + fi |
| 44 | +
|
| 45 | + create: |
| 46 | + needs: check |
| 47 | + if: needs.check.outputs.should_run == 'true' |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v4 |
| 51 | + with: |
| 52 | + fetch-depth: 0 |
| 53 | + |
| 54 | + - name: Configure git |
| 55 | + run: | |
| 56 | + git config user.name "dx-examples-bot" |
| 57 | + git config user.email "noreply@deepgram.com" |
| 58 | +
|
| 59 | + - name: Get date |
| 60 | + id: date |
| 61 | + run: echo "date=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT |
| 62 | + |
| 63 | + - name: Run create agent |
| 64 | + uses: anthropics/claude-code-action@beta |
| 65 | + with: |
| 66 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 67 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + mode: agent |
| 69 | + model: claude-opus-4-6 |
| 70 | + allowed_tools: "Bash,Read,Write,Edit,Glob,Grep,WebSearch,WebFetch" |
| 71 | + direct_prompt: | |
| 72 | + Read and execute the instructions in `instructions/create-example.md`. |
| 73 | +
|
| 74 | + Context: |
| 75 | + - Today's date: ${{ steps.date.outputs.date }} |
| 76 | + - Repository: ${{ github.repository }} |
| 77 | + - Run ID: ${{ github.run_id }} |
| 78 | + - Trigger: ${{ github.event_name }} |
| 79 | + - Issue number (if triggered by issue): ${{ github.event.issue.number }} |
| 80 | + - Issue title (if triggered by issue): ${{ github.event.issue.title }} |
| 81 | + - Manual integration input: ${{ inputs.integration }} |
| 82 | +
|
| 83 | + Process up to 3 queued examples from open issues labelled `queue:new-example`. |
| 84 | + If no queue items exist and this is a scheduled run, pick a high-value integration |
| 85 | + from the discovery categories in `instructions/discover-examples.md`. |
0 commit comments