Skip to content

Commit

Permalink
Change userIdentifiers to userEmails for branch rules bypass (#47)
Browse files Browse the repository at this point in the history
* rename userIdentifiers to userEmails for branch rules bypass
  • Loading branch information
atefehmohseni authored and Harness committed Jul 16, 2024
1 parent 328e912 commit bcd612e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions internal/gitexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ func extractUsers(repo *types.RepoData, users map[string]bool) {
}

for _, rule := range repo.BranchRules {
for _, user := range rule.RuleDefinition.Bypass.UserIdentifiers {
users[user] = true
for _, email := range rule.RuleDefinition.Bypass.UserEmails {
users[email] = true
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions internal/migrate/stash/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ func convertBranchModelsMap(from branchModels) map[string]modelValue {
}

func mapRuleDefinition(t string, bypassUsers []author) types.RuleDefinition {
var users []string
var emails []string
for _, u := range bypassUsers {
users = append(users, u.EmailAddress)
emails = append(emails, u.EmailAddress)
}

lifecycle := types.Lifecycle{}
Expand All @@ -263,7 +263,7 @@ func mapRuleDefinition(t string, bypassUsers []author) types.RuleDefinition {
return types.RuleDefinition{
Lifecycle: lifecycle,
Bypass: types.Bypass{
UserIdentifiers: users,
UserEmails: emails,
},
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ type (
}

Bypass struct {
UserIdentifiers []string
RepoOwners bool
UserEmails []string
RepoOwners bool
}

Approvals struct {
Expand Down
4 changes: 2 additions & 2 deletions types/git_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ type (
}

Bypass struct {
UserIdentifiers []string `json:"user_identifiers,omitempty"`
RepoOwners bool `json:"repo_owners,omitempty"`
UserEmails []string `json:"user_emails,omitempty"`
RepoOwners bool `json:"repo_owners,omitempty"`
}

Approvals struct {
Expand Down

0 comments on commit bcd612e

Please sign in to comment.