diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d72b6ba..b1003dc 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -3,8 +3,30 @@ name: "CodeQL" on: push: branches: [main] + paths: + - '**.js' + - '**.ts' + - '**.tsx' + - '**.jsx' + - 'backend/package.json' + - 'backend/package-lock.json' + - 'frontend/package.json' + - 'frontend/package-lock.json' + - '.github/codeql/**' + - '.github/workflows/codeql.yml' pull_request: branches: [main] + paths: + - '**.js' + - '**.ts' + - '**.tsx' + - '**.jsx' + - 'backend/package.json' + - 'backend/package-lock.json' + - 'frontend/package.json' + - 'frontend/package-lock.json' + - '.github/codeql/**' + - '.github/workflows/codeql.yml' schedule: - cron: "0 6 * * 1" # Weekly on Monday at 6am UTC workflow_dispatch: # Allow manual trigger diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f739bf3..22c614f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,10 +10,38 @@ permissions: jobs: # ============================================================================= - # Backend Tests + # Detect which paths changed to skip unnecessary jobs + # ============================================================================= + changes: + name: Detect Changes + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + outputs: + backend: ${{ steps.filter.outputs.backend }} + frontend: ${{ steps.filter.outputs.frontend }} + steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + backend: + - 'backend/**' + - 'biome.json' + - '.github/workflows/test.yml' + frontend: + - 'frontend/**' + - 'biome.json' + - '.github/workflows/test.yml' + + # ============================================================================= + # Backend Tests (skipped if no backend-related files changed) # ============================================================================= backend-test: name: Backend Tests + needs: changes + if: needs.changes.outputs.backend == 'true' runs-on: ubuntu-latest permissions: contents: read @@ -53,10 +81,12 @@ jobs: retention-days: 7 # ============================================================================= - # Frontend Build Validation + # Frontend Build Validation (skipped if no frontend-related files changed) # ============================================================================= frontend-build: name: Frontend Build + needs: changes + if: needs.changes.outputs.frontend == 'true' runs-on: ubuntu-latest permissions: contents: read