Update docs #68
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: Agent Task Execution (Content) | |
| on: | |
| issues: | |
| types: [labeled] | |
| concurrency: | |
| group: agent-issue-${{ github.event.issue.number }} | |
| cancel-in-progress: false | |
| jobs: | |
| route: | |
| if: >- | |
| github.event.label.name == 'agent:seo-vi' || | |
| github.event.label.name == 'agent:seo-cw3' || | |
| github.event.label.name == 'agent:biz-dev' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| runner: ${{ steps.pick.outputs.runner }} | |
| steps: | |
| - name: Pick runner by label | |
| id: pick | |
| env: | |
| LABEL: ${{ github.event.label.name }} | |
| run: | | |
| case "$LABEL" in | |
| agent:seo-cw3) | |
| echo "runner=content-cw3" >> $GITHUB_OUTPUT | |
| ;; | |
| *) | |
| echo "runner=content" >> $GITHUB_OUTPUT | |
| ;; | |
| esac | |
| execute: | |
| needs: route | |
| runs-on: [self-hosted, "${{ needs.route.outputs.runner }}"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: dev | |
| fetch-depth: 0 | |
| clean: false | |
| - name: Install dependencies and generate Prisma | |
| timeout-minutes: 30 | |
| run: | | |
| if [ -f node_modules/.yarn-integrity ]; then | |
| echo "node_modules cached, skipping install" | |
| else | |
| yarn install --frozen-lockfile || yarn install | |
| fi | |
| npx prisma generate 2>/dev/null || true | |
| npx prisma generate --schema=prisma/events/schema.prisma 2>/dev/null || true | |
| printf "DATABASE_URL=%s\nEVENTS_DATABASE_URL=%s\n" "$DATABASE_URL" "$EVENTS_DATABASE_URL" > .env | |
| - name: Determine role and execute | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| WORKFLOW_NAME: task-execute-content | |
| GITHUB_RUN_ID: ${{ github.run_id }} | |
| ISSUE_TITLE: ${{ github.event.issue.title }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| run: | | |
| LABELS=$(gh issue view $ISSUE_NUMBER --json labels -q '.labels[].name') | |
| BODY=$(gh issue view $ISSUE_NUMBER --json body -q '.body') | |
| PROMPT_FILE=".claude/agents/seo-vi.md" | |
| ROLE="seo-vi" | |
| for R in seo-vi seo-cw3 biz-dev; do | |
| if echo "$LABELS" | grep -q "agent:$R"; then | |
| PROMPT_FILE=".claude/agents/${R}.md" | |
| ROLE="$R" | |
| break | |
| fi | |
| done | |
| SYSTEM=$(cat "$PROMPT_FILE") | |
| ./agents-tools/run-agent.sh \ | |
| --agent "$ROLE" --role "content" --trigger issue \ | |
| --issue "$ISSUE_NUMBER" \ | |
| --prompt-file "$PROMPT_FILE" \ | |
| -- "${SYSTEM} | |
| TASK: ${ISSUE_TITLE} | |
| ISSUE: #${ISSUE_NUMBER} | |
| DETAILS: ${BODY}" | |
| if [ $? -ne 0 ]; then | |
| echo "Agent failed. See monitoring.db for details." | |
| exit 1 | |
| fi |