diff --git a/.github/README.md b/.github/README.md index 5637bf5..5ac5a25 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,4 +1,4 @@ -# go-test-sarif +# go-test-sarif and go-test-sarif-action `go-test-sarif` is a CLI tool and GitHub Action for converting `go test -json` output into SARIF format, making it compatible with GitHub Security Tab and other SARIF consumers. @@ -15,13 +15,13 @@ making it compatible with GitHub Security Tab and other SARIF consumers. ### Using `go install` ```sh -go install github.com/ivuorinen/go-test-sarif@latest +go install github.com/ivuorinen/go-test-sarif-action@latest ``` ### Using Docker ```sh -docker pull ghcr.io/ivuorinen/go-test-sarif:latest +docker pull ghcr.io/ivuorinen/go-test-sarif-action:latest ``` ## 🛠️ Usage @@ -36,7 +36,7 @@ go-test-sarif go-test-results.json go-test-results.sarif ### Docker Usage ```sh -docker run --rm -v $(pwd):/workspace ghcr.io/ivuorinen/go-test-sarif go-test-results.json go-test-results.sarif +docker run --rm -v $(pwd):/workspace ghcr.io/ivuorinen/go-test-sarif-action go-test-results.json go-test-results.sarif ``` ### GitHub Action Usage @@ -45,7 +45,7 @@ Add the following step to your GitHub Actions workflow: ```yaml - name: Convert JSON to SARIF - uses: ivuorinen/go-test-sarif@v1 + uses: ivuorinen/go-test-sarif-action@v1 with: test_results: go-test-results.json ``` @@ -101,7 +101,7 @@ SARIF report example: Clone the repository and build the project: ```sh -git clone https://github.com/ivuorinen/go-test-sarif.git +git clone https://github.com/ivuorinen/go-test-sarif-action.git cd go-test-sarif go build -o go-test-sarif ./cmd/main.go ``` diff --git a/.github/workflows/publish-immutable-actions.yml b/.github/workflows/publish-immutable-actions.yml index 7fa720f..feaa083 100644 --- a/.github/workflows/publish-immutable-actions.yml +++ b/.github/workflows/publish-immutable-actions.yml @@ -6,6 +6,8 @@ on: release: types: [published] +permissions: read-all + jobs: publish: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a4b08d3..72d3460 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: run: go test -json ./... > go-test-results.json - name: Convert JSON to SARIF - uses: ivuorinen/go-test-sarif@58ffaaacdb178a5d053f8e8c2693966422a3ecda # v1 + uses: ivuorinen/go-test-sarif-action@58ffaaacdb178a5d053f8e8c2693966422a3ecda # v1 with: input_file: go-test-results.json output_file: go-test-results.sarif diff --git a/LICENSE.md b/LICENSE.md index bffa737..a2d31aa 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -MIT License +# MIT License Copyright (c) 2024 Ismo Vuorinen diff --git a/action.yml b/action.yml index 4509f48..33ae589 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,7 @@ runs: using: 'composite' steps: - name: Convert Go test results to SARIF - uses: ivuorinen/go-test-sarif@58ffaaacdb178a5d053f8e8c2693966422a3ecda # v1 + uses: ivuorinen/go-test-sarif-action@58ffaaacdb178a5d053f8e8c2693966422a3ecda # v1 with: input_file: ${{ inputs.input_file }} output_file: ${{ inputs.output_file }} diff --git a/cmd/main.go b/cmd/main.go index 1a10ffe..3d968fe 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -5,7 +5,7 @@ import ( "fmt" "os" - "github.com/ivuorinen/go-test-sarif/internal" + "github.com/ivuorinen/go-test-sarif-action/internal" ) func main() { diff --git a/go.mod b/go.mod index 1b79db5..fc2f59b 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/ivuorinen/go-test-sarif +module github.com/ivuorinen/go-test-sarif-action go 1.24.1 diff --git a/internal/converter.go b/internal/converter.go index fb8da46..f9db834 100644 --- a/internal/converter.go +++ b/internal/converter.go @@ -29,12 +29,12 @@ func ConvertToSARIF(inputFile, outputFile string) error { } // Convert test results to SARIF format - sarifData := map[string]interface{}{ + sarifData := map[string]any{ "version": "2.1.0", - "runs": []map[string]interface{}{ + "runs": []map[string]any{ { - "tool": map[string]interface{}{ - "driver": map[string]interface{}{ + "tool": map[string]any{ + "driver": map[string]any{ "name": "go-test-sarif", "version": "1.0.0", }, @@ -60,7 +60,7 @@ func ConvertToSARIF(inputFile, outputFile string) error { } // convertResults transforms test results into SARIF result objects. -func convertResults(testResults []TestResult) []map[string]interface{} { +func convertResults(testResults []TestResult) []map[string]any { var results []map[string]any for _, tr := range testResults { if tr.Action == "fail" {