Skip to content

Commit

Permalink
Fix spelling of brand GitHub (#106)
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* Revert breaking change in env variables

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
Co-authored-by: Mateusz Szostok <szostok.mateusz@gmail.com>
  • Loading branch information
3 people committed Feb 12, 2022
1 parent 5367f8a commit e933870
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,6 @@ Contributions are greatly appreciated! The project follows the typical GitHub pu

## Roadmap

The [codeowners-validator roadmap uses Github milestones](https://github.com/mszostok/codeowners-validator/milestone/1) to track the progress of the project.
The [codeowners-validator roadmap uses GitHub milestones](https://github.com/mszostok/codeowners-validator/milestone/1) to track the progress of the project.

They are sorted with priority. First are most important.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "GitHub CODEOWNERS Validator"
description: "Github action to ensure the correctness of your CODEOWNERS file."
description: "GitHub action to ensure the correctness of your CODEOWNERS file."
author: "szostok.mateusz@gmail.com"

inputs:
Expand Down
12 changes: 6 additions & 6 deletions internal/check/valid_owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ func isEmailAddress(s string) bool {
return err == nil
}

func isGithubTeam(s string) bool {
func isGitHubTeam(s string) bool {
hasPrefix := strings.HasPrefix(s, "@")
containsSlash := strings.Contains(s, "/")
split := strings.SplitN(s, "/", 3) // 3 is enough to confirm that is invalid + will not overflow the buffer
return hasPrefix && containsSlash && len(split) == 2 && len(split[1]) > 0
}

func isGithubUser(s string) bool {
func isGitHubUser(s string) bool {
return !strings.Contains(s, "/") && strings.HasPrefix(s, "@")
}

Expand All @@ -133,9 +133,9 @@ func (v *ValidOwner) isIgnoredOwner(name string) bool {

func (v *ValidOwner) selectValidateFn(name string) func(context.Context, string) *validateError {
switch {
case isGithubUser(name):
return v.validateGithubUser
case isGithubTeam(name):
case isGitHubUser(name):
return v.validateGitHubUser
case isGitHubTeam(name):
return v.validateTeam
case isEmailAddress(name):
// TODO(mszostok): try to check if e-mail really exists
Expand Down Expand Up @@ -266,7 +266,7 @@ func (v *ValidOwner) validateTeam(ctx context.Context, name string) *validateErr
return nil
}

func (v *ValidOwner) validateGithubUser(ctx context.Context, name string) *validateError {
func (v *ValidOwner) validateGitHubUser(ctx context.Context, name string) *validateError {
if v.orgMembers == nil { //TODO(mszostok): lazy init, make it more robust.
if err := v.initOrgListMembers(ctx); err != nil {
return newValidateError("Cannot initialize organization member list: %v", err).AsPermanent()
Expand Down
2 changes: 1 addition & 1 deletion internal/check/valid_owner_export_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package check

func IsValidOwner(owner string) bool {
return isEmailAddress(owner) || isGithubUser(owner) || isGithubTeam(owner)
return isEmailAddress(owner) || isGitHubUser(owner) || isGitHubTeam(owner)
}

0 comments on commit e933870

Please sign in to comment.