Skip to content

fix: remove NuGet cache and locked-mode from CI workflow #3

fix: remove NuGet cache and locked-mode from CI workflow

fix: remove NuGet cache and locked-mode from CI workflow #3

Workflow file for this run

name: security

Check failure on line 1 in .github/workflows/security.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/security.yml

Invalid workflow file

(Line: 64, Col: 9): Unrecognized function: 'hashFiles'. Located at position 1 within expression: hashFiles('**/Dockerfile') != ''
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '17 3 * * 1'
permissions:
contents: read
security-events: write
jobs:
codeql:
name: CodeQL analyze
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v5
with:
dotnet-version: '8.0.x'
- name: Initialize CodeQL (C# + JS/TS)
uses: github/codeql-action/init@v4
with:
languages: csharp,javascript-typescript
build-mode: autobuild
- name: Autobuild (C#)
uses: github/codeql-action/autobuild@v4
- name: Analyze
uses: github/codeql-action/analyze@v4
with:
category: "/language:multi"
trivy-fs:
name: Trivy (repo scan → SARIF)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Trivy repo scan (fs)
uses: aquasecurity/[email protected]
with:
scan-type: 'fs'
scan-ref: '.'
format: 'sarif'
output: 'trivy-fs.sarif'
ignore-unfixed: true
severity: 'CRITICAL,HIGH,MEDIUM'
- name: Upload SARIF to Code Scanning
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: trivy-fs.sarif
trivy-image:
name: Trivy (container image → SARIF)
runs-on: ubuntu-latest
if: ${{ hashFiles('**/Dockerfile') != '' }}
steps:
- uses: actions/checkout@v4
- name: Build API image (if Dockerfile present)
run: |
docker build -t app2-api:ci -f src/App2.Api/Dockerfile .
- name: Trivy image scan
uses: aquasecurity/[email protected]
with:
scan-type: 'image'
image-ref: 'app2-api:ci'
format: 'sarif'
output: 'trivy-image.sarif'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
- name: Upload SARIF to Code Scanning
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: trivy-image.sarif