From 597f6aa4c2ccd8c22d46055441837a94840eda56 Mon Sep 17 00:00:00 2001 From: Brad Egler Date: Fri, 10 Feb 2023 16:35:23 -0500 Subject: [PATCH] feat: pin action.yml dependencies with Ratchet (#28) --- action.yml | 2 +- cmd/lint-action/main.go | 5 ++++- cmd/lint-terraform/main.go | 5 ++++- pkg/linter/linter.go | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 73d2ae4..aa33f96 100644 --- a/action.yml +++ b/action.yml @@ -47,7 +47,7 @@ runs: using: 'composite' steps: - name: 'setup-terraform' - uses: 'hashicorp/setup-terraform@v2' + uses: 'hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1' # ratchet:hashicorp/setup-terraform@v2 with: terraform_version: '${{ inputs.terraform_version }}' terraform_wrapper: '${{ inputs.terraform_wrapper }}' diff --git a/cmd/lint-action/main.go b/cmd/lint-action/main.go index 268d635..7dfca02 100644 --- a/cmd/lint-action/main.go +++ b/cmd/lint-action/main.go @@ -67,5 +67,8 @@ func realMain() error { return fmt.Errorf("expected at least one argument, got %d", got) } - return linter.RunLinter(ctx, args, &linter.GitHubActionLinter{}) + if err := linter.RunLinter(ctx, args, &linter.GitHubActionLinter{}); err != nil { + return fmt.Errorf("error running linter %w", err) + } + return nil } diff --git a/cmd/lint-terraform/main.go b/cmd/lint-terraform/main.go index c0d7047..73d22d9 100644 --- a/cmd/lint-terraform/main.go +++ b/cmd/lint-terraform/main.go @@ -67,5 +67,8 @@ func realMain() error { return fmt.Errorf("expected at least one argument, got %d", got) } - return linter.RunLinter(ctx, args, &linter.TerraformLinter{}) + if err := linter.RunLinter(ctx, args, &linter.TerraformLinter{}); err != nil { + return fmt.Errorf("error running linter %w", err) + } + return nil } diff --git a/pkg/linter/linter.go b/pkg/linter/linter.go index abece02..88c696b 100644 --- a/pkg/linter/linter.go +++ b/pkg/linter/linter.go @@ -92,7 +92,7 @@ func lint(path string, linter Linter) ([]*ViolationInstance, error) { } results, err := linter.FindViolations(content, path) if err != nil { - return nil, err + return nil, fmt.Errorf("error searching for violations %w", err) } instances = append(instances, results...) } @@ -104,7 +104,7 @@ func lint(path string, linter Linter) ([]*ViolationInstance, error) { func isDirectory(path string) (bool, error) { fileInfo, err := os.Stat(path) if err != nil { - return false, err + return false, fmt.Errorf("error reading file information %w", err) } return fileInfo.IsDir(), err }