mirror of
https://github.com/ivuorinen/go-test-sarif.git
synced 2026-03-12 17:00:34 +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,
|
`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.
|
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`
|
### Using `go install`
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
go install github.com/ivuorinen/go-test-sarif@latest
|
go install github.com/ivuorinen/go-test-sarif-action@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Docker
|
### Using Docker
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker pull ghcr.io/ivuorinen/go-test-sarif:latest
|
docker pull ghcr.io/ivuorinen/go-test-sarif-action:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🛠️ Usage
|
## 🛠️ Usage
|
||||||
@@ -36,7 +36,7 @@ go-test-sarif go-test-results.json go-test-results.sarif
|
|||||||
### Docker Usage
|
### Docker Usage
|
||||||
|
|
||||||
```sh
|
```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
|
### GitHub Action Usage
|
||||||
@@ -45,7 +45,7 @@ Add the following step to your GitHub Actions workflow:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Convert JSON to SARIF
|
- name: Convert JSON to SARIF
|
||||||
uses: ivuorinen/go-test-sarif@v1
|
uses: ivuorinen/go-test-sarif-action@v1
|
||||||
with:
|
with:
|
||||||
test_results: go-test-results.json
|
test_results: go-test-results.json
|
||||||
```
|
```
|
||||||
@@ -101,7 +101,7 @@ SARIF report example:
|
|||||||
|
|
||||||
Clone the repository and build the project:
|
Clone the repository and build the project:
|
||||||
```sh
|
```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
|
cd go-test-sarif
|
||||||
go build -o go-test-sarif ./cmd/main.go
|
go build -o go-test-sarif ./cmd/main.go
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ on:
|
|||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
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
|
run: go test -json ./... > go-test-results.json
|
||||||
|
|
||||||
- name: Convert JSON to SARIF
|
- name: Convert JSON to SARIF
|
||||||
uses: ivuorinen/go-test-sarif@58ffaaacdb178a5d053f8e8c2693966422a3ecda # v1
|
uses: ivuorinen/go-test-sarif-action@58ffaaacdb178a5d053f8e8c2693966422a3ecda # v1
|
||||||
with:
|
with:
|
||||||
input_file: go-test-results.json
|
input_file: go-test-results.json
|
||||||
output_file: go-test-results.sarif
|
output_file: go-test-results.sarif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
MIT License
|
# MIT License
|
||||||
|
|
||||||
Copyright (c) 2024 Ismo Vuorinen
|
Copyright (c) 2024 Ismo Vuorinen
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ runs:
|
|||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- name: Convert Go test results to SARIF
|
- name: Convert Go test results to SARIF
|
||||||
uses: ivuorinen/go-test-sarif@58ffaaacdb178a5d053f8e8c2693966422a3ecda # v1
|
uses: ivuorinen/go-test-sarif-action@58ffaaacdb178a5d053f8e8c2693966422a3ecda # v1
|
||||||
with:
|
with:
|
||||||
input_file: ${{ inputs.input_file }}
|
input_file: ${{ inputs.input_file }}
|
||||||
output_file: ${{ inputs.output_file }}
|
output_file: ${{ inputs.output_file }}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/ivuorinen/go-test-sarif/internal"
|
"github.com/ivuorinen/go-test-sarif-action/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
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
|
go 1.24.1
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ func ConvertToSARIF(inputFile, outputFile string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert test results to SARIF format
|
// Convert test results to SARIF format
|
||||||
sarifData := map[string]interface{}{
|
sarifData := map[string]any{
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"runs": []map[string]interface{}{
|
"runs": []map[string]any{
|
||||||
{
|
{
|
||||||
"tool": map[string]interface{}{
|
"tool": map[string]any{
|
||||||
"driver": map[string]interface{}{
|
"driver": map[string]any{
|
||||||
"name": "go-test-sarif",
|
"name": "go-test-sarif",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
},
|
},
|
||||||
@@ -60,7 +60,7 @@ func ConvertToSARIF(inputFile, outputFile string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convertResults transforms test results into SARIF result objects.
|
// 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
|
var results []map[string]any
|
||||||
for _, tr := range testResults {
|
for _, tr := range testResults {
|
||||||
if tr.Action == "fail" {
|
if tr.Action == "fail" {
|
||||||
|
|||||||
Reference in New Issue
Block a user