-
Notifications
You must be signed in to change notification settings - Fork 0
Add Copilot setup workflow #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8c1731b
4881ad9
68c3c20
20986ab
c077023
3ec7644
3e6a3c6
69eb45b
ec136be
c37956a
e330b10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,117 @@ | ||||||||||||
| name: "Copilot Setup Steps" | ||||||||||||
|
|
||||||||||||
| on: | ||||||||||||
| workflow_dispatch: | ||||||||||||
| push: | ||||||||||||
| paths: | ||||||||||||
| - .github/workflows/copilot-setup-steps.yml | ||||||||||||
| pull_request: | ||||||||||||
| paths: | ||||||||||||
| - .github/workflows/copilot-setup-steps.yml | ||||||||||||
|
|
||||||||||||
| jobs: | ||||||||||||
| copilot-setup-steps: | ||||||||||||
| runs-on: ubuntu-latest | ||||||||||||
| timeout-minutes: 30 | ||||||||||||
| permissions: | ||||||||||||
| contents: read | ||||||||||||
|
|
||||||||||||
| steps: | ||||||||||||
| - name: Checkout code | ||||||||||||
| uses: actions/checkout@v5 | ||||||||||||
|
|
||||||||||||
| # Engines: Node >=20, npm >=10 | ||||||||||||
| - name: Set up Node 20 | ||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||
| with: | ||||||||||||
| node-version: "20" | ||||||||||||
| cache: "npm" | ||||||||||||
|
|
||||||||||||
| - name: Use npm 10 (per package.json engines) | ||||||||||||
| run: npm i -g npm@10 | ||||||||||||
|
|
||||||||||||
| - name: Copy env file | ||||||||||||
| run: | | ||||||||||||
| if [ -f ".env.example" ]; then | ||||||||||||
| cp .env.example .env | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| - name: Install dependencies | ||||||||||||
| run: npm ci | ||||||||||||
|
|
||||||||||||
| # ---------- Playwright MCP (system deps + browsers) ---------- | ||||||||||||
| - name: Install Playwright deps & browsers | ||||||||||||
| if: ${{ hashFiles('playwright.config.*') != '' || hashFiles('.playwright-mcp/**') != '' }} | ||||||||||||
| run: | | ||||||||||||
| npx playwright install-deps | ||||||||||||
| npx playwright install | ||||||||||||
|
|
||||||||||||
| - name: Cache Playwright browsers | ||||||||||||
| if: ${{ hashFiles('playwright.config.*') != '' || hashFiles('.playwright-mcp/**') != '' }} | ||||||||||||
| uses: actions/cache@v4 | ||||||||||||
| with: | ||||||||||||
| path: ~/.cache/ms-playwright | ||||||||||||
| key: ${{ runner.os }}-playwright-${{ hashFiles('playwright.config.*', '.playwright-mcp/**') }} | ||||||||||||
|
|
||||||||||||
| # ---------- Prisma + SQLite (prisma/dev.db) ---------- | ||||||||||||
| - name: Generate Prisma client (SQLite) | ||||||||||||
| env: | ||||||||||||
| DATABASE_URL: "file:./prisma/dev.db" | ||||||||||||
| run: | | ||||||||||||
| mkdir -p prisma | ||||||||||||
| npx prisma generate | ||||||||||||
|
|
||||||||||||
| - name: Init SQLite schema (db push) | ||||||||||||
| env: | ||||||||||||
| DATABASE_URL: "file:./prisma/dev.db" | ||||||||||||
| run: npx prisma db push --accept-data-loss | ||||||||||||
|
|
||||||||||||
| - name: Apply migrations (optional if present) | ||||||||||||
| env: | ||||||||||||
| DATABASE_URL: "file:./prisma/dev.db" | ||||||||||||
| run: | | ||||||||||||
| if [ -f "prisma/schema.prisma" ] && [ -d "prisma/migrations" ]; then | ||||||||||||
| npx prisma migrate deploy || true | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| - name: Seed database (uses your npm script) | ||||||||||||
| env: | ||||||||||||
| DATABASE_URL: "file:./prisma/dev.db" | ||||||||||||
| run: | | ||||||||||||
| if [ -f "prisma/seed.ts" ]; then | ||||||||||||
| npm run db:seed | ||||||||||||
| else | ||||||||||||
| echo "No prisma/seed.ts found; skipping." | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| # ---------- Type checking ---------- | ||||||||||||
| - name: Type check | ||||||||||||
| run: npm run type-check | ||||||||||||
|
|
||||||||||||
| - name: Save type-check errors to JSON (PowerShell script with Linux fallback) | ||||||||||||
|
||||||||||||
| - name: Save type-check errors to JSON (PowerShell script with Linux fallback) | |
| - name: Save type-check errors to JSON (npm script with PowerShell fallback) |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PID capture logic is flawed. If 'npm run dev' fails immediately, the shell will still execute 'echo $! > /tmp/next_pid' with the PID of the failed subshell. The kill command on line 105 should verify the process exists before attempting to kill it, or use 'kill -0' to check process existence first.
| kill $(cat /tmp/next_pid) || true | |
| NEXT_PID=$(cat /tmp/next_pid) | |
| if kill -0 "$NEXT_PID" 2>/dev/null; then | |
| kill "$NEXT_PID" || true | |
| fi |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backgrounded process PID may not be captured correctly. If npm run dev & fails, the echo $! > /tmp/next_pid still executes due to the || operator binding, writing the wrong PID. The entire command should be wrapped: (npm run dev > /dev/null 2>&1 & echo $! > /tmp/next_pid) to ensure the PID file is only created if the process starts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the coding guidelines, Node.js version should be 18.x or higher, but the project specifically targets 18.x. The workflow uses Node 20, which may introduce compatibility issues. Consider using Node 18 to match the documented tech stack requirement.