@@ -76,7 +76,7 @@ func (pushService *pushService) createRepository() (*github.Repository, error) {
76
76
Name : github .String (pushService .destinationRepositoryOwner ),
77
77
}, user .GetLogin ())
78
78
if err != nil {
79
- if response != nil && response .StatusCode == http .StatusNotFound && githubapiutil .MissingAllScopes (response , "site_admin" ) {
79
+ if response != nil && response .StatusCode == http .StatusNotFound && ! githubapiutil .HasAnyScope (response , "site_admin" ) {
80
80
return nil , usererrors .New ("The destination token you have provided does not have the `site_admin` scope, so the destination organization cannot be created." )
81
81
}
82
82
return nil , errors .Wrap (err , "Error creating organization." )
@@ -105,15 +105,15 @@ func (pushService *pushService) createRepository() (*github.Repository, error) {
105
105
if response .StatusCode == http .StatusNotFound {
106
106
repository , response , err = pushService .githubEnterpriseClient .Repositories .Create (pushService .ctx , destinationOrganization , & desiredRepositoryProperties )
107
107
if err != nil {
108
- if response .StatusCode == http .StatusNotFound && githubapiutil .MissingAllScopes (response , "public_repo" , "repo" ) {
108
+ if response .StatusCode == http .StatusNotFound && ! githubapiutil .HasAnyScope (response , "public_repo" , "repo" ) {
109
109
return nil , usererrors .New ("The destination token you have provided does not have the `public_repo` scope." )
110
110
}
111
111
return nil , errors .Wrap (err , "Error creating destination repository." )
112
112
}
113
113
} else {
114
114
repository , response , err = pushService .githubEnterpriseClient .Repositories .Edit (pushService .ctx , pushService .destinationRepositoryOwner , pushService .destinationRepositoryName , & desiredRepositoryProperties )
115
115
if err != nil {
116
- if response .StatusCode == http .StatusNotFound && githubapiutil .MissingAllScopes (response , "public_repo" , "repo" ) {
116
+ if response .StatusCode == http .StatusNotFound && ! githubapiutil .HasAnyScope (response , "public_repo" , "repo" ) {
117
117
return nil , usererrors .New ("The destination token you have provided does not have the `public_repo` scope." )
118
118
}
119
119
return nil , errors .Wrap (err , "Error updating destination repository." )
0 commit comments