diff --git a/internal/push/push.go b/internal/push/push.go index a0bf272..f1413f2 100644 --- a/internal/push/push.go +++ b/internal/push/push.go @@ -99,12 +99,12 @@ func (pushService *pushService) createRepository() (*github.Repository, error) { } } - _, response, err = pushService.githubEnterpriseClient.Organizations.GetOrgMembership(pushService.ctx, user.GetLogin(), pushService.destinationRepositoryOwner) - if err != nil && (response == nil || response.StatusCode != http.StatusNotFound) { + _, response, err = pushService.githubEnterpriseClient.Organizations.IsMember(pushService.ctx, pushService.destinationRepositoryOwner, user.GetLogin()) + if err != nil { return nil, errors.Wrap(err, "Failed to check membership of destination organization.") } - if err != nil && githubapiutil.HasAnyScope(response, "site_admin") { - log.Debugf("No access to destination organization. Switching to impersonation token for %s...", pushService.actionsAdminUser) + if (response.StatusCode == http.StatusFound || response.StatusCode == http.StatusNotFound) && githubapiutil.HasAnyScope(response, "site_admin") { + log.Debugf("No access to destination organization (status code %d). Switching to impersonation token for %s...", response.StatusCode, pushService.actionsAdminUser) impersonationToken, _, err := pushService.githubEnterpriseClient.Admin.CreateUserImpersonation(pushService.ctx, pushService.actionsAdminUser, &github.ImpersonateUserOptions{Scopes: []string{minimumRepositoryScope, "workflow"}}) if err != nil { return nil, errors.Wrap(err, "Failed to impersonate Actions admin user.") pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy