func ExistGitHubRepository(scope, gheDomain string, githubPersonalToken string) error {
	repoURL, err := getRepositoryURL(scope, gheDomain)
	if err != nil {
		return fmt.Errorf("failed to get repository url: %w", err)
	}
	client := http.DefaultClient
	req, err := http.NewRequest(http.MethodGet, repoURL, nil)
	if err != nil {
		return fmt.Errorf("failed to create request: %w", err)
	}
	req.Header.Add("Authorization", fmt.Sprintf("token %s", githubPersonalToken))
	resp, err := client.Do(req)
	if err != nil {
		return fmt.Errorf("failed to do request: %w", err)
	}
	if resp.StatusCode == http.StatusOK {
		return nil
	} else if resp.StatusCode == http.StatusNotFound {
		return errors.New("not found")
	}
	return fmt.Errorf("invalid response code (%d)", resp.StatusCode)
}
ExistGitHubRepository check exist of github repository
package gh
import (
	"context"
	"errors"
	"fmt"
	"net/http"
	"net/url"
	"path"
	"strings"
	"time"
	"github.com/patrickmn/go-cache"
	"github.com/bradleyfalzon/ghinstallation"
	"github.com/google/go-github/v35/github"
	"github.com/whywaita/myshoes/internal/config"
	"github.com/whywaita/myshoes/pkg/logger"
	"golang.org/x/oauth2"
)
var (
	ErrNotFound = fmt.Errorf("not found")
	responseCache *cache.Cache
)
func init() {
	c := cache.New(5*time.Minute, 10*time.Minute)
	responseCache = c
}
func NewClient(ctx context.Context, personalToken, gheDomain string) (*github.Client, error) {
	ts := oauth2.StaticTokenSource(
		&oauth2.Token{
			AccessToken: personalToken,
		})
	tc := oauth2.NewClient(ctx, ts)
	if gheDomain == "" {
		return github.NewClient(tc), nil
	}
	return github.NewEnterpriseClient(gheDomain, gheDomain, tc)
}
func NewClientGitHubApps(gheDomain string, appID int64, appPEM []byte) (*github.Client, error) {
	tr := http.DefaultTransport
	itr, err := ghinstallation.NewAppsTransport(tr, appID, appPEM)
	if err != nil {
		return nil, fmt.Errorf("failed to create Apps transport: %w", err)
	}
	if gheDomain == "" {
		return github.NewClient(&http.Client{Transport: itr}), nil
	}
	apiEndpoint, err := getAPIEndpoint(gheDomain)
	if err != nil {
		return nil, fmt.Errorf("failed to get GitHub API Endpoint: %w", err)
	}
	itr.BaseURL = apiEndpoint.String()
	return github.NewEnterpriseClient(gheDomain, gheDomain, &http.Client{Transport: itr})
}
func NewClientInstallation(gheDomain string, installationID int64, appID int64, appPEM []byte) (*github.Client, error) {
	tr := http.DefaultTransport
	itr, err := ghinstallation.New(tr, appID, installationID, appPEM)
	if err != nil {
		return nil, fmt.Errorf("failed to create Apps transport: %w", err)
	}
	if gheDomain == "" {
		return github.NewClient(&http.Client{Transport: itr}), nil
	}
	apiEndpoint, err := getAPIEndpoint(gheDomain)
	if err != nil {
		return nil, fmt.Errorf("failed to get GitHub API Endpoint: %w", err)
	}
	itr.BaseURL = apiEndpoint.String()
	return github.NewEnterpriseClient(gheDomain, gheDomain, &http.Client{Transport: itr})
}
func CheckSignature(installationID int64) error {
	appID := config.Config.GitHub.AppID
	pem := config.Config.GitHub.PEMByte
	tr := http.DefaultTransport
	_, err := ghinstallation.New(tr, appID, installationID, pem)
	if err != nil {
		return fmt.Errorf("failed to create GitHub installation: %w", err)
	}
	return nil
}