mirror of
https://github.com/ivuorinen/go-test-sarif.git
synced 2026-01-26 03:04:09 +00:00
feat: change repo name
This commit is contained in:
12
.github/README.md
vendored
12
.github/README.md
vendored
@@ -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
|
||||
```
|
||||
|
||||
@@ -6,6 +6,8 @@ on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
MIT License
|
||||
# MIT License
|
||||
|
||||
Copyright (c) 2024 Ismo Vuorinen
|
||||
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/ivuorinen/go-test-sarif/internal"
|
||||
"github.com/ivuorinen/go-test-sarif-action/internal"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
2
go.mod
2
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
|
||||
|
||||
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user