dotnet build with CodeQL #22
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: dotnet build with CodeQL | |
| on: | |
| workflow_call: | |
| inputs: | |
| build-ref: | |
| required: true | |
| type: string | |
| workflow_dispatch: | |
| schedule: # for CodeQL | |
| - cron: '30 4 1 * *' # on every month's first day at 4:30 UTC | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_GENERATE_ASPNET_CERTIFICATE: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| security-events: write # for CodeQL | |
| actions: read # for CodeQL | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # avoid shallow clone so nbgv can do its work. | |
| lfs: true | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.x # global-json-file: wouldn't use the latestMinor with setup-dotnet@v4 | |
| - uses: dotnet/[email protected] | |
| id: nbgv | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v3 | |
| with: | |
| languages: csharp | |
| - run: dotnet restore | |
| - run: dotnet build -c Release --no-restore | |
| - run: dotnet pack -c Release --no-restore | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v3 |