Skip to content

Commit

Permalink
Update workflow action versions (#914)
Browse files Browse the repository at this point in the history
* chore: Update workflow action versions

Signed-off-by: John Reese <john@reese.dev>

* fix: Resolve linting errors

Signed-off-by: John Reese <john@reese.dev>

---------

Signed-off-by: John Reese <john@reese.dev>
  • Loading branch information
jpreese committed Feb 10, 2024
1 parent e20f3ee commit 324d7fb
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pr.yaml
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout all PR branch and commits
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ github.event.pull_request.commits }}
Expand All @@ -35,7 +35,7 @@ jobs:
uses: actions/checkout@v4

- name: setup go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.21.x"

Expand All @@ -51,7 +51,7 @@ jobs:
run: make test

- name: setup bats
uses: mig4/setup-bats@v1
uses: bats-core/bats-action@1.5.4

- name: test examples
run: make test-examples
Expand Down
4 changes: 2 additions & 2 deletions internal/commands/default.go
Expand Up @@ -31,7 +31,7 @@ func NewDefaultCommand() *cobra.Command {
Short: "Test your configuration files using Open Policy Agent",
Version: createVersionString(),
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
if err := viper.BindPFlag("config-file", cmd.Flags().Lookup("config-file")); err != nil {
return fmt.Errorf("bind flag: %s", err)
}
Expand Down Expand Up @@ -80,7 +80,7 @@ func newCommandFromPlugin(ctx context.Context, p *plugin.Plugin) *cobra.Command
Use: p.Name,
Short: p.Usage,
Long: p.Description,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
if err := p.Exec(ctx, args); err != nil {
return fmt.Errorf("execute plugin: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/commands/fmt.go
Expand Up @@ -18,14 +18,14 @@ func NewFormatCommand() *cobra.Command {
cmd := cobra.Command{
Use: "fmt <path> [path [...]]",
Short: "Format Rego files",
PreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, _ []string) error {
if err := viper.BindPFlag("check", cmd.Flags().Lookup("check")); err != nil {
return fmt.Errorf("bind flag: %w", err)
}

return nil
},
RunE: func(cmd *cobra.Command, files []string) error {
RunE: func(_ *cobra.Command, files []string) error {
policies, err := loader.AllRegos(files)
if err != nil {
return fmt.Errorf("get rego files: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/parse.go
Expand Up @@ -42,7 +42,7 @@ func NewParseCommand() *cobra.Command {

return nil
},
RunE: func(cmd *cobra.Command, files []string) error {
RunE: func(_ *cobra.Command, files []string) error {
var configurations map[string]interface{}
var err error
if viper.GetString("parser") != "" {
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/pull.go
Expand Up @@ -50,7 +50,7 @@ func NewPullCommand(ctx context.Context) *cobra.Command {
Use: "pull <repository>",
Short: "Download individual policies",
Long: pullDesc,
PreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, _ []string) error {
if err := viper.BindPFlag("policy", cmd.Flags().Lookup("policy")); err != nil {
return fmt.Errorf("bind flag: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/push.go
Expand Up @@ -59,7 +59,7 @@ func NewPushCommand(ctx context.Context, logger *log.Logger) *cobra.Command {
Use: "push <repository>",
Short: "Push OPA bundles to an OCI registry",
Long: pushDesc,
PreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, _ []string) error {
if err := viper.BindPFlag("policy", cmd.Flags().Lookup("policy")); err != nil {
return fmt.Errorf("bind flag: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/test.go
Expand Up @@ -82,7 +82,7 @@ func NewTestCommand(ctx context.Context) *cobra.Command {
Use: "test <path> [path [...]]",
Short: "Test your configuration files using Open Policy Agent",
Long: testDesc,
PreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, _ []string) error {
flagNames := []string{
"all-namespaces",
"combine",
Expand Down
4 changes: 2 additions & 2 deletions internal/commands/verify.go
Expand Up @@ -67,7 +67,7 @@ func NewVerifyCommand(ctx context.Context) *cobra.Command {
Use: "verify <path> [path [...]]",
Short: "Verify Rego unit tests",
Long: verifyDesc,
PreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, _ []string) error {
flagNames := []string{
"data",
"no-color",
Expand All @@ -90,7 +90,7 @@ func NewVerifyCommand(ctx context.Context) *cobra.Command {

return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
var runner runner.VerifyRunner
if err := viper.Unmarshal(&runner); err != nil {
return fmt.Errorf("unmarshal parameters: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/registry/client.go
Expand Up @@ -22,7 +22,7 @@ func SetupClient(repository *remote.Repository) {

client := auth.DefaultClient
client.SetUserAgent("conftest")
client.Credential = func(ctx context.Context, registry string) (auth.Credential, error) {
client.Credential = func(_ context.Context, registry string) (auth.Credential, error) {
host := dockercfg.ResolveRegistryHost(registry)
username, password, err := dockercfg.GetRegistryCredentials(host)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion plugin/xdg_test.go
Expand Up @@ -99,7 +99,7 @@ func TestFind(t *testing.T) {
os.Unsetenv(XDGDataDirs)
return "/does/not/exist", nil
},
func(path string) error {
func(_ string) error {
return nil
},
func(_ string) string {
Expand Down
4 changes: 2 additions & 2 deletions policy/engine.go
Expand Up @@ -69,7 +69,7 @@ func newCompiler(c compilerOptions) *ast.Compiler {

// Load returns an Engine after loading all of the specified policies.
func Load(policyPaths []string, c compilerOptions) (*Engine, error) {
policies, err := loader.NewFileLoader().WithProcessAnnotation(true).Filtered(policyPaths, func(_ string, info os.FileInfo, depth int) bool {
policies, err := loader.NewFileLoader().WithProcessAnnotation(true).Filtered(policyPaths, func(_ string, info os.FileInfo, _ int) bool {
return !info.IsDir() && !strings.HasSuffix(info.Name(), bundle.RegoExt)
})

Expand Down Expand Up @@ -124,7 +124,7 @@ func LoadWithData(policyPaths []string, dataPaths []string, capabilities string,

// FilteredPaths will recursively find all file paths that contain a valid document
// extension from the given list of data paths.
allDocumentPaths, err := loader.FilteredPaths(dataPaths, func(abspath string, info os.FileInfo, depth int) bool {
allDocumentPaths, err := loader.FilteredPaths(dataPaths, func(_ string, info os.FileInfo, _ int) bool {
if info.IsDir() {
return false
}
Expand Down

0 comments on commit 324d7fb

Please sign in to comment.