Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Download dependencies
run: go mod download

- name: Run tests
run: go test -v -race -coverprofile=coverage.out ./...

- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.out

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
args: --timeout=5m

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Build
run: go build -v ./...
8 changes: 4 additions & 4 deletions internal/files/yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ func TestConvertToYAMLPath(t *testing.T) {
{"containers[0].image", "$.containers[0].image", false},
{"$.already.prefixed", "$.already.prefixed", false},
// Error cases
{".image.tag", "", true}, // Leading dot
{".version", "", true}, // Leading dot
{"..recursive", "", true}, // Double dot
{"", "", true}, // Empty path
{".image.tag", "", true}, // Leading dot
{".version", "", true}, // Leading dot
{"..recursive", "", true}, // Double dot
{"", "", true}, // Empty path
}

for _, tt := range tests {
Expand Down
2 changes: 1 addition & 1 deletion internal/github/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestPRRequest_Validate(t *testing.T) {
}{
{
name: "valid request",
modify: func(r *PRRequest) {},
modify: func(_ *PRRequest) {},
wantErr: "",
},
{
Expand Down
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func getModifiedFiles(cfg Config) []string {
// runHelmDocs executes helm-docs with the provided arguments and returns the list of modified files.
func runHelmDocs(argsStr string) ([]string, error) {
args := strings.Fields(argsStr)
cmd := exec.Command("helm-docs", args...)
cmd := exec.Command("helm-docs", args...) //nolint:gosec // args are from trusted input
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
Expand All @@ -304,7 +304,7 @@ func getGitModifiedFiles() ([]string, error) {
return nil, fmt.Errorf("running git status: %w", err)
}

var files []string
var result []string
for _, line := range strings.Split(string(output), "\n") {
line = strings.TrimSpace(line)
if line == "" {
Expand All @@ -315,11 +315,11 @@ func getGitModifiedFiles() ([]string, error) {
if len(line) >= 3 {
file := strings.TrimSpace(line[2:])
if file != "" {
files = append(files, file)
result = append(result, file)
}
}
}
return files, nil
return result, nil
}

func setOutput(name, value string) {
Expand Down