updating ci workflow #13
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
| name: PR Quality Gate | |
| on: | |
| pull_request: | |
| branches: [ "leader" ] | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Branch to check' | |
| required: true | |
| default: 'leader' | |
| jobs: | |
| quality-gate: | |
| runs-on: self-hosted | |
| timeout-minutes: 20 | |
| env: | |
| # Force color output for better readability in CI logs | |
| FORCE_COLOR: 1 | |
| steps: | |
| # 1. Clean Checkout & Runtime Prep | |
| # Mirroring: "Create necessary runtime directories" | |
| - name: Checkout & Prep | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.branch || github.ref }} | |
| fetch-depth: 0 | |
| clean: true | |
| - name: Create Runtime Directories | |
| run: | | |
| mkdir -p logs | |
| echo "✅ Created 'logs' directory" | |
| # 2. Configure Environment | |
| # Mirroring: "Configure Environment Variables" | |
| - name: Configure .env.local | |
| run: | | |
| echo "📝 Creating .env.local with development defaults..." | |
| cat > .env.local <<EOL | |
| # Auto-generated by CI | |
| NEXTAUTH_URL=http://127.0.0.1:3000 | |
| NEXTAUTH_SECRET=jules-dev-environment-secret-123 | |
| SPOTIFY_CLIENT_ID=placeholder_id | |
| SPOTIFY_CLIENT_SECRET=placeholder_secret | |
| EOL | |
| echo "✅ .env.local created" | |
| # 3. Install pnpm | |
| # Mirroring: "Ensure pnpm is installed" | |
| # We use the official action for better caching and stability in CI | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| cache: "pnpm" | |
| # 4. Install Dependencies | |
| # Mirroring: "Install Node.js Dependencies" (pnpm install) | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| # 5. Install Playwright Browsers | |
| # Mirroring: "Install Playwright Chromium binary" | |
| - name: Install Playwright (Chromium) | |
| run: pnpm exec playwright install chromium --with-deps | |
| # 6. Quality Checks & Build | |
| # Mirroring: "Verify Build & Types" | |
| - name: Lint Code | |
| run: pnpm run lint | |
| - name: Verify Build | |
| run: pnpm run build | |
| # 7. Optional: Run Tests (As referenced in your setup script echo) | |
| # Uncomment if you want actual test execution in this gate | |
| # - name: Run Core Tests | |
| # run: pnpm run test:core | |
| # 8. Commit Message Linting (Your original requirement) | |
| - name: Lint commit messages | |
| run: | | |
| echo "🔍 Verifying Conventional Commits..." | |
| RANGE="origin/leader..HEAD" | |
| if ! git rev-parse --verify origin/leader >/dev/null 2>&1; then RANGE="HEAD"; fi | |
| git log --format=%s $RANGE | while read line; do | |
| if [[ ! "$line" =~ ^(feat|fix|docs|style|refactor|test|chore|perf|ci)(\(.+\))?: ]]; then | |
| echo "::error::Invalid Commit Message: $line" | |
| exit 1 | |
| fi | |
| done |