diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a5e744..931460d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,7 +89,7 @@ jobs: name: Publish containers runs-on: ubuntu-latest needs: build - if: github.event_name == 'push' + if: github.event_name == 'push' && github.ref == 'refs/heads/main' permissions: contents: read packages: write diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..e2ac5bb --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,58 @@ +name: CodeQL + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: '0 6 * * 1' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + security-events: write + + strategy: + fail-fast: false + matrix: + include: + - language: csharp + build-mode: autobuild + - language: javascript-typescript + build-mode: none + + steps: + - uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + + - if: matrix.build-mode == 'autobuild' + name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - if: matrix.build-mode == 'autobuild' + run: dotnet workload install aspire + + - if: matrix.build-mode == 'autobuild' + run: dotnet tool restore + + - if: matrix.build-mode == 'autobuild' + run: dotnet restore ./ScrumPoker.slnx + + - if: matrix.build-mode == 'autobuild' + name: Build .NET + run: dotnet build --no-restore -c Release ./ScrumPoker.slnx + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{ matrix.language }}"