Files
go-test-sarif/.github/workflows/test.yml

40 lines
1.0 KiB
YAML

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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: 'go.mod'
- name: Run Go Tests
shell: bash
run: go test -json ./... > go-test-results.json
- name: Convert JSON to SARIF
uses: ivuorinen/go-test-sarif-action@58ffaaacdb178a5d053f8e8c2693966422a3ecda # v1
with:
input_file: go-test-results.json
output_file: go-test-results.sarif
- name: Upload SARIF to GitHub Security Tab
uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
with:
sarif_file: go-test-results.sarif