feat: harden Agent Ready discovery surface #14
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: Verified Demo Assets | |
| on: | |
| pull_request: | |
| paths: | |
| - "examples/safe-agent-api/**" | |
| - ".github/scripts/capture-demo.mjs" | |
| - ".github/scripts/build-demo-gif.py" | |
| - ".github/workflows/demo-assets.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| capture: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout source branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref || github.ref_name }} | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| cache-dependency-path: examples/safe-agent-api/pyproject.toml | |
| - name: Install Safe Agent API and image tools | |
| run: | | |
| python -m pip install -e "examples/safe-agent-api[dev]" | |
| python -m pip install Pillow==11.3.0 | |
| - name: Start Safe Agent API | |
| run: | | |
| cd examples/safe-agent-api | |
| fastapi run app/main.py --host 127.0.0.1 --port 8000 > /tmp/safe-agent-api.log 2>&1 & | |
| echo $! > /tmp/safe-agent-api.pid | |
| for attempt in {1..30}; do | |
| if curl --fail --silent http://127.0.0.1:8000/health >/dev/null; then | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| cat /tmp/safe-agent-api.log | |
| exit 1 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install Playwright Chromium | |
| run: | | |
| npm install --no-save playwright@1.55.0 | |
| npx playwright install --with-deps chromium | |
| - name: Capture real Playground frames | |
| run: node .github/scripts/capture-demo.mjs | tee /tmp/demo-capture.log | |
| - name: Build optimized GIF from verified frames | |
| run: python .github/scripts/build-demo-gif.py | |
| - name: Validate and report asset sizes | |
| run: | | |
| test -s assets/demo/safe-agent-playground.png | |
| test -s assets/demo/safe-agent-demo.gif | |
| ls -lh assets/demo/safe-agent-playground.png assets/demo/safe-agent-demo.gif | |
| - name: Upload verified assets | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: safe-agent-demo-assets | |
| path: | | |
| assets/demo/safe-agent-playground.png | |
| assets/demo/safe-agent-demo.gif | |
| if-no-files-found: error | |
| retention-days: 14 | |
| - name: Commit verified assets to source branch | |
| if: >- | |
| github.event_name == 'pull_request' && | |
| github.event.pull_request.head.repo.full_name == github.repository && | |
| github.actor != 'github-actions[bot]' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add assets/demo/safe-agent-playground.png assets/demo/safe-agent-demo.gif | |
| if git diff --cached --quiet; then | |
| echo "Verified assets are unchanged." | |
| exit 0 | |
| fi | |
| git commit -m "docs: refresh verified demo assets" | |
| git push origin "HEAD:${GITHUB_HEAD_REF}" | |
| - name: Show API logs on failure | |
| if: failure() | |
| run: cat /tmp/safe-agent-api.log || true |