feat(agent-actions): auto-close a contributor's PR over the open-PR cap (#2270) #635
Workflow file for this run
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
| # Self-host stack CI (#980/#982). Provides integration coverage the main CI can't: | |
| # 1. Postgres integration test — needs a real PG service container | |
| # 2. Self-host bundle build validation (build-selfhost.mjs) | |
| # 3. Docker image build + container smoke test (/health, /ready, /metrics) | |
| # Unit tests and typecheck are NOT duplicated here — the main CI validate job covers them. | |
| name: self-host | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "src/selfhost/**" | |
| - "src/server.ts" | |
| - "scripts/build-selfhost.mjs" | |
| - "scripts/validate-selfhost-sourcemap.mjs" | |
| - "scripts/register-selfhost.mjs" | |
| - "Dockerfile" | |
| - "docker-compose.yml" | |
| - "migrations/**" | |
| - "test/unit/selfhost-*" | |
| - "test/integration/selfhost-pg*" | |
| - ".github/workflows/selfhost.yml" | |
| pull_request: | |
| paths: | |
| - "src/selfhost/**" | |
| - "src/server.ts" | |
| - "scripts/build-selfhost.mjs" | |
| - "scripts/validate-selfhost-sourcemap.mjs" | |
| - "scripts/register-selfhost.mjs" | |
| - "Dockerfile" | |
| - "docker-compose.yml" | |
| - "migrations/**" | |
| - "test/unit/selfhost-*" | |
| - "test/integration/selfhost-pg*" | |
| - ".github/workflows/selfhost.yml" | |
| # Least privilege — the smoke test only reads the repo; no writes, no packages. | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-boot: | |
| name: build + boot smoke test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| env: | |
| POSTGRES_PASSWORD: devpw | |
| POSTGRES_DB: gittensory | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" --health-interval 5s --health-timeout 5s --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: "24.18.0" | |
| cache: "npm" | |
| - name: Install deps | |
| run: npm ci --ignore-scripts | |
| - name: Postgres integration test (real PG) | |
| run: PG_TEST_URL=postgres://postgres:devpw@localhost:5432/gittensory npx vitest run test/integration/selfhost-pg.test.ts | |
| - name: Build the self-host bundle | |
| run: node scripts/build-selfhost.mjs | |
| - name: Validate self-host source map | |
| run: node scripts/validate-selfhost-sourcemap.mjs | |
| - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 | |
| - name: Build the Docker image | |
| run: | | |
| docker buildx build \ | |
| --cache-from type=gha \ | |
| --cache-to type=gha,mode=max \ | |
| --load \ | |
| -t gittensory:selfhost-ci . | |
| - name: Smoke-test bundled AI CLIs | |
| run: | | |
| docker run --rm --entrypoint sh gittensory:selfhost-ci -c \ | |
| 'command -v claude && claude --version && command -v codex && codex --version' | |
| - name: Build release target with visual review deps | |
| run: | | |
| docker buildx build \ | |
| --target runtime-prebuilt \ | |
| --build-context selfhost_dist=./dist \ | |
| --build-arg INSTALL_VISUAL_REVIEW=true \ | |
| --load \ | |
| -t gittensory:selfhost-prebuilt-visual-ci . | |
| docker run --rm --entrypoint node gittensory:selfhost-prebuilt-visual-ci \ | |
| -e "import('puppeteer-core').then(() => console.log('puppeteer-core ok'))" | |
| - name: Boot the container + smoke-test /health, /ready, /metrics, migrations | |
| run: | | |
| docker network create gt-smoke | |
| docker run -d --name gt-redis --network gt-smoke redis:7-alpine | |
| trap 'docker rm -f gt gt-redis >/dev/null 2>&1 || true; docker network rm gt-smoke >/dev/null 2>&1 || true' EXIT | |
| for _ in $(seq 1 30); do | |
| if docker exec gt-redis redis-cli ping | grep -q PONG; then break; fi | |
| sleep 1 | |
| done | |
| docker run -d --name gt --network gt-smoke -p 8787:8787 -e REDIS_URL=redis://gt-redis:6379 gittensory:selfhost-ci | |
| ok=0 | |
| for _ in $(seq 1 30); do | |
| if curl -sf http://127.0.0.1:8787/health >/dev/null; then ok=1; break; fi | |
| sleep 2 | |
| done | |
| if [ "$ok" != "1" ]; then echo "::error::container did not become healthy"; docker logs gt; exit 1; fi | |
| curl -sf http://127.0.0.1:8787/health | grep -q '"status":"ok"' | |
| curl -sf http://127.0.0.1:8787/ready | grep -q '"ok":true' | |
| curl -sf http://127.0.0.1:8787/metrics | grep -q 'gittensory_uptime_seconds' | |
| docker logs gt 2>&1 | grep -q 'selfhost_migrations_applied' | |
| echo "self-host smoke test passed" |