--- name: Run Go Tests and Generate SARIF on: push: branches: - main pull_request: permissions: read-all jobs: test: runs-on: ubuntu-latest permissions: contents: read security-events: write steps: - name: Checkout code uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - name: Setup Go uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 with: go-version-file: "go.mod" - name: Install golangci-lint uses: golangci/golangci-lint-action@e7fa5ac41e1cf5b7d48e45e42232ce7ada589601 # v9.1.0 with: version: latest - name: Run Linters run: | go vet ./... golangci-lint run - name: Run Go Tests shell: bash run: go test -json ./... > go-test-results.json - name: Convert JSON to SARIF run: go run ./cmd/main.go go-test-results.json go-test-results.sarif - name: Upload SARIF to GitHub Security Tab uses: github/codeql-action/upload-sarif@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5 with: sarif_file: go-test-results.sarif