Skip to content

Commit

Permalink
Fix dependency-groups (#95)
Browse files Browse the repository at this point in the history
The original implementation of dependency-groups for the CLI treats
rules as a list of strings.
The actual implementation of dependency-groups is a hash where the
key is the type of dependency-group and the value is the group's rules.

For now there is only one type of dependency-group that is supported,
"patterns". However, in the future there may be more types that are
supported, so we must specify the type here.

This PR updates dependency-groups so that rules are now of type
`map[string]any`. The job test reflects this change by passing in
a key/value pair of rules in the form of `pattern: [patterns]`
  • Loading branch information
Nishnha authored Apr 14, 2023
1 parent 5c42fd1 commit 5e54f08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/model/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ type Allowed struct {
}

type Group struct {
GroupName string `json:"name,omitempty" yaml:"name,omitempty"`
Rules []string `json:"rules,omitempty" yaml:"rules,omitempty"`
GroupName string `json:"name,omitempty" yaml:"name,omitempty"`
Rules map[string]any `json:"rules,omitempty" yaml:"rules,omitempty"`
}

type Condition struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/model/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ job:
update-type: all
dependency-groups:
- name: npm
rules: ["npm", "@npmcli*"]
rules:
patterns: ["npm", "@npmcli*"]
credentials-metadata:
- type: git_source
host: github.com
Expand Down

0 comments on commit 5e54f08

Please sign in to comment.