diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..b958233 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,65 @@ +name: CodeQL + +on: + push: + branches: [main, dev] + pull_request: + branches: [main, dev] + schedule: + - cron: "23 5 * * 1" + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + include: + - language: go + build-mode: manual + - language: javascript-typescript + build-mode: none + + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Set up Go + if: matrix.language == 'go' + uses: actions/setup-go@v6 + with: + go-version: "1.25" + + - name: Install swag + if: matrix.language == 'go' + run: go install github.com/swaggo/swag/cmd/swag@latest + + - name: Generate Swagger docs + if: matrix.language == 'go' + working-directory: backend + run: swag init -d cmd/server,internal/api -g main.go --parseDependency --parseInternal -o docs + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + + # The Go module lives in backend/ and its swagger docs package is + # generated above. Autobuild cannot locate the module from the repo + # root, so build explicitly from backend/ here. + - name: Build Go + if: matrix.language == 'go' + working-directory: backend + run: go build ./... + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{ matrix.language }}"