This repository was archived by the owner on Jun 16, 2026. It is now read-only.
feat: add dogfood workflow for Phase 2 rollout #1
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: Dogfood | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "src/**" | |
| - "package.json" | |
| - ".github/workflows/dogfood.yml" | |
| workflow_dispatch: | |
| concurrency: | |
| group: dogfood-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| dogfood: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - run: npm ci | |
| - run: npm run build | |
| # --- Scenario: resolve-real-loadout --- | |
| # Exercise the real product: resolve a loadout from a real dispatch table | |
| - name: "Step: create-dispatch-table" | |
| id: create_table | |
| run: | | |
| # Create a realistic dispatch table for resolution | |
| mkdir -p /tmp/loadout-test | |
| cat > /tmp/loadout-test/dispatch.yaml << 'TABLE_EOF' | |
| version: "1" | |
| entries: | |
| - name: test-rule | |
| description: "Test dispatch entry" | |
| keywords: [test, dogfood, ci] | |
| path: ./payload.md | |
| tokens: 100 | |
| TABLE_EOF | |
| cat > /tmp/loadout-test/payload.md << 'PAYLOAD_EOF' | |
| --- | |
| name: test-payload | |
| description: Test payload for dogfood | |
| type: reference | |
| --- | |
| This is a test payload for the dogfood scenario. | |
| PAYLOAD_EOF | |
| echo "status=pass" >> "$GITHUB_OUTPUT" | |
| - name: "Step: resolve-loadout" | |
| id: resolve | |
| run: | | |
| # Use the CLI to resolve against the dispatch table | |
| node src/cli.js resolve --query "test dogfood" --table /tmp/loadout-test/dispatch.yaml 2>&1 | tee /tmp/resolve.log | |
| if [ $? -eq 0 ]; then | |
| echo "status=pass" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "status=fail" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: "Step: verify-output" | |
| id: verify_output | |
| run: | | |
| # Confirm resolver produced output referencing the test entry | |
| if [ -s /tmp/resolve.log ] && grep -q "test" /tmp/resolve.log; then | |
| echo "status=pass" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "status=fail" >> "$GITHUB_OUTPUT" | |
| fi | |
| # --- Verdict --- | |
| - name: Determine overall verdict | |
| id: verdict | |
| run: | | |
| T="${{ steps.create_table.outputs.status }}" | |
| R="${{ steps.resolve.outputs.status }}" | |
| V="${{ steps.verify_output.outputs.status }}" | |
| if [ "$T" = "pass" ] && [ "$R" = "pass" ] && [ "$V" = "pass" ]; then | |
| echo "verdict=pass" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "verdict=fail" >> "$GITHUB_OUTPUT" | |
| fi | |
| # --- Build + dispatch --- | |
| - name: Build submission | |
| run: | | |
| FINISHED_AT=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
| cat > /tmp/submission.json << 'INNER_EOF' | |
| { | |
| "schema_version": "1.0.0", | |
| "run_id": "ai-loadout-RUN_ID-ATTEMPT", | |
| "repo": "REPO_SLUG", | |
| "ref": { | |
| "branch": "REF_NAME", | |
| "commit_sha": "COMMIT_SHA" | |
| }, | |
| "source": { | |
| "provider": "github", | |
| "workflow": "dogfood.yml", | |
| "provider_run_id": "PROVIDER_RUN_ID", | |
| "attempt": ATTEMPT_NUM, | |
| "run_url": "RUN_URL_PLACEHOLDER", | |
| "actor": "ACTOR_NAME" | |
| }, | |
| "timing": { | |
| "started_at": "STARTED_PLACEHOLDER", | |
| "finished_at": "FINISHED_PLACEHOLDER", | |
| "duration_ms": 0 | |
| }, | |
| "ci_checks": [], | |
| "scenario_results": [ | |
| { | |
| "scenario_id": "resolve-real-loadout", | |
| "scenario_name": "Resolve a loadout from a dispatch table", | |
| "scenario_version": "1.0.0", | |
| "product_surface": "cli", | |
| "execution_mode": "bot", | |
| "verdict": "VERDICT_PLACEHOLDER", | |
| "step_results": [ | |
| { "step_id": "create-dispatch-table", "status": "TABLE_STATUS" }, | |
| { "step_id": "resolve-loadout", "status": "RESOLVE_STATUS" }, | |
| { "step_id": "verify-output", "status": "VERIFY_STATUS" } | |
| ], | |
| "evidence": [ | |
| { | |
| "kind": "log", | |
| "url": "RUN_URL_PLACEHOLDER", | |
| "description": "CI run log with resolve output" | |
| } | |
| ], | |
| "notes": "Bot-driven resolve against test dispatch table" | |
| } | |
| ], | |
| "overall_verdict": "VERDICT_PLACEHOLDER", | |
| "notes": "Phase 2 rollout: ai-loadout CLI dogfood." | |
| } | |
| INNER_EOF | |
| sed -i "s|REPO_SLUG|${GITHUB_REPOSITORY}|g" /tmp/submission.json | |
| sed -i "s|REF_NAME|${GITHUB_REF_NAME}|g" /tmp/submission.json | |
| sed -i "s|COMMIT_SHA|${GITHUB_SHA}|g" /tmp/submission.json | |
| sed -i "s|PROVIDER_RUN_ID|${GITHUB_RUN_ID}|g" /tmp/submission.json | |
| sed -i "s|ATTEMPT_NUM|${GITHUB_RUN_ATTEMPT}|g" /tmp/submission.json | |
| sed -i "s|RUN_URL_PLACEHOLDER|https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}|g" /tmp/submission.json | |
| sed -i "s|ACTOR_NAME|${GITHUB_ACTOR}|g" /tmp/submission.json | |
| sed -i "s|STARTED_PLACEHOLDER|${{ github.event.head_commit.timestamp || github.event.repository.pushed_at }}|g" /tmp/submission.json | |
| sed -i "s|FINISHED_PLACEHOLDER|${FINISHED_AT}|g" /tmp/submission.json | |
| sed -i "s|ai-loadout-RUN_ID-ATTEMPT|ai-loadout-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}|g" /tmp/submission.json | |
| sed -i "s|VERDICT_PLACEHOLDER|${{ steps.verdict.outputs.verdict }}|g" /tmp/submission.json | |
| sed -i "s|TABLE_STATUS|${{ steps.create_table.outputs.status }}|g" /tmp/submission.json | |
| sed -i "s|RESOLVE_STATUS|${{ steps.resolve.outputs.status }}|g" /tmp/submission.json | |
| sed -i "s|VERIFY_STATUS|${{ steps.verify_output.outputs.status }}|g" /tmp/submission.json | |
| jq empty /tmp/submission.json | |
| echo "Submission built:" | |
| jq '.run_id, .overall_verdict' /tmp/submission.json | |
| - name: Dispatch to dogfood-labs | |
| env: | |
| GH_TOKEN: ${{ secrets.DOGFOOD_TOKEN }} | |
| run: | | |
| SUBMISSION=$(cat /tmp/submission.json) | |
| RUN_ID=$(echo "$SUBMISSION" | jq -r '.run_id') | |
| if [ -z "$GH_TOKEN" ]; then | |
| echo "::warning::DOGFOOD_TOKEN not set — skipping dispatch" | |
| exit 0 | |
| fi | |
| jq -n --argjson sub "$SUBMISSION" \ | |
| '{"event_type":"dogfood_submission","client_payload":{"submission":$sub}}' \ | |
| | gh api repos/mcp-tool-shop-org/dogfood-labs/dispatches \ | |
| --input - --silent | |
| echo "Dispatched $RUN_ID to dogfood-labs" |