or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

actions.mdadditional-services.mdapps.mdchecks.mdclient.mdenterprise.mdgit.mdindex.mdissues.mdorganizations.mdrepositories.mdteams.mdusers.md
tile.json

repositories.mddocs/

Repositories

Comprehensive repository management including creation, configuration, content operations, branches, collaborators, releases, webhooks, deployments, and security settings.

RepositoriesService

The RepositoriesService provides 221 methods for complete repository management on GitHub.

type RepositoriesService struct{}

Repository Operations

Get Repository

// Get fetches a repository
func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error)

// GetByID fetches a repository by ID
func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repository, *Response, error)

List Repositories

// List public repositories for a user or organization
func (s *RepositoriesService) List(ctx context.Context, user string, opts *RepositoryListOptions) ([]*Repository, *Response, error)

// ListByUser lists public repositories for the specified user
func (s *RepositoriesService) ListByUser(ctx context.Context, user string, opts *RepositoryListByUserOptions) ([]*Repository, *Response, error)

// ListByOrg lists repositories for an organization
func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *RepositoryListByOrgOptions) ([]*Repository, *Response, error)

// ListByAuthenticatedUser lists repositories for the authenticated user
func (s *RepositoriesService) ListByAuthenticatedUser(ctx context.Context, opts *RepositoryListByAuthenticatedUserOptions) ([]*Repository, *Response, error)

// ListAll lists all GitHub repositories (admin only)
func (s *RepositoriesService) ListAll(ctx context.Context, opts *RepositoryListAllOptions) ([]*Repository, *Response, error)

Create Repository

// Create a new repository
func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repository) (*Repository, *Response, error)

// CreateFromTemplate generates a repository from a template
func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, templateRepoReq *TemplateRepoRequest) (*Repository, *Response, error)

// CreateFork creates a fork of the specified repository
func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opts *RepositoryCreateForkOptions) (*Repository, *Response, error)

Usage:

// Create a new repository
newRepo := &github.Repository{
    Name:        github.Ptr("my-new-repo"),
    Description: github.Ptr("A test repository"),
    Private:     github.Ptr(false),
    AutoInit:    github.Ptr(true),
}

// For user repo, use empty string for org
repo, _, err := client.Repositories.Create(ctx, "", newRepo)

// For organization repo, specify org name
repo, _, err := client.Repositories.Create(ctx, "my-org", newRepo)

Edit and Delete Repository

// Edit updates a repository
func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *Repository) (*Repository, *Response, error)

// Delete a repository
func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*Response, error)

// Transfer a repository to another account or organization
func (s *RepositoriesService) Transfer(ctx context.Context, owner, repo string, transfer TransferRequest) (*Repository, *Response, error)

Repository Content Operations

Get Contents

// GetContents can return metadata and content of a single file or directory listing
func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string, opts *RepositoryContentGetOptions) (*RepositoryContent, []*RepositoryContent, *Response, error)

// GetReadme gets the Readme file for the repository
func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, opts *RepositoryContentGetOptions) (*RepositoryContent, *Response, error)

// DownloadContents returns an io.ReadCloser that reads file contents
func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, filepath string, opts *RepositoryContentGetOptions) (io.ReadCloser, *Response, error)

// DownloadContentsWithMeta is identical to DownloadContents but additionally returns metadata
func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owner, repo, filepath string, opts *RepositoryContentGetOptions) (io.ReadCloser, *RepositoryContent, *Response, error)

Usage:

// Get file contents
fileContent, _, resp, err := client.Repositories.GetContents(
    ctx, "owner", "repo", "path/to/file.txt", nil)
if err != nil {
    // Handle error
}

// fileContent.Content contains base64 encoded content
content, err := fileContent.GetContent()
fmt.Println(content)

// Get directory listing
_, directoryContent, resp, err := client.Repositories.GetContents(
    ctx, "owner", "repo", "path/to/directory", nil)
for _, file := range directoryContent {
    fmt.Printf("%s (%s)\n", *file.Name, *file.Type)
}

Create, Update, Delete Files

// CreateFile creates a new file in a repository
func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error)

// UpdateFile updates a file in a repository
func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error)

// DeleteFile deletes a file from a repository
func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error)

Usage:

// Create a new file
content := []byte("Hello, World!")
opts := &github.RepositoryContentFileOptions{
    Message: github.Ptr("Create hello.txt"),
    Content: content,
    Branch:  github.Ptr("main"),
}

createResp, _, err := client.Repositories.CreateFile(
    ctx, "owner", "repo", "hello.txt", opts)

// Update existing file (requires SHA of current content)
opts = &github.RepositoryContentFileOptions{
    Message: github.Ptr("Update hello.txt"),
    Content: []byte("Updated content"),
    SHA:     createResp.Content.SHA,
    Branch:  github.Ptr("main"),
}

updateResp, _, err := client.Repositories.UpdateFile(
    ctx, "owner", "repo", "hello.txt", opts)

// Delete file (requires SHA of current content)
opts = &github.RepositoryContentFileOptions{
    Message: github.Ptr("Delete hello.txt"),
    SHA:     updateResp.Content.SHA,
    Branch:  github.Ptr("main"),
}

_, _, err = client.Repositories.DeleteFile(
    ctx, "owner", "repo", "hello.txt", opts)

Archive Operations

// GetArchiveLink returns URL to download a tarball or zipball archive
func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat ArchiveFormat, opts *RepositoryContentGetOptions, maxRedirects int) (*url.URL, *Response, error)

Branch Operations

List and Get Branches

// ListBranches lists branches for the specified repository
func (s *RepositoriesService) ListBranches(ctx context.Context, owner, repo string, opts *BranchListOptions) ([]*Branch, *Response, error)

// GetBranch gets the specified branch for a repository
func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string, maxRedirects int) (*Branch, *Response, error)

// ListBranchesHeadCommit gets all branches where the given commit SHA is the HEAD
func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, repo, sha string) ([]*BranchCommit, *Response, error)

Branch Management

// RenameBranch renames a branch in a repository
func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, branch, newName string) (*Branch, *Response, error)

Branch Protection

// GetBranchProtection gets the protection of a given branch
func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error)

// UpdateBranchProtection updates the protection of a given branch
func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error)

// RemoveBranchProtection removes the protection of a given branch
func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error)

Branch Protection Components

// Required status checks
func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*RequiredStatusChecks, *Response, error)
func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error)
func (s *RepositoriesService) RemoveRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*Response, error)
func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Context, owner, repo, branch string) ([]string, *Response, error)

// Pull request review enforcement
func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error)
func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error)
func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error)
func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error)

// Admin enforcement
func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error)
func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error)
func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error)

// Signature requirement
func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error)
func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error)
func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*Response, error)

Branch Restrictions

// User restrictions
func (s *RepositoriesService) ListUserRestrictions(ctx context.Context, owner, repo, branch string) ([]*User, *Response, error)
func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error)
func (s *RepositoriesService) RemoveUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error)
func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error)

// Team restrictions
func (s *RepositoriesService) ListTeamRestrictions(ctx context.Context, owner, repo, branch string) ([]*Team, *Response, error)
func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error)
func (s *RepositoriesService) RemoveTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error)
func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error)

// App restrictions
func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error)
func (s *RepositoriesService) ListAppRestrictions(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error)
func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error)
func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error)
func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error)

Commit Operations

List and Get Commits

// ListCommits lists the commits of a repository
func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo string, opts *CommitsListOptions) ([]*RepositoryCommit, *Response, error)

// GetCommit fetches the specified commit, including all details
func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) (*RepositoryCommit, *Response, error)

// GetCommitRaw fetches the specified commit in raw (diff or patch) format
func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner, repo, sha string, opts RawOptions) (string, *Response, error)

// GetCommitSHA1 gets the SHA-1 of a commit reference
func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *Response, error)

Compare Commits

// CompareCommits compares a range of commits
func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string, opts *ListOptions) (*CommitsComparison, *Response, error)

// CompareCommitsRaw compares a range of commits in raw (diff or patch) format
func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo, base, head string, opts RawOptions) (string, *Response, error)

Commit Comments

// ListComments lists all comments for the repository
func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryComment, *Response, error)

// ListCommitComments lists all comments for a given commit SHA
func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*RepositoryComment, *Response, error)

// GetComment gets a single comment from a repository
func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int64) (*RepositoryComment, *Response, error)

// CreateComment creates a comment for the given commit
func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error)

// UpdateComment updates the body of a single comment
func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, comment *RepositoryComment) (*RepositoryComment, *Response, error)

// DeleteComment deletes a single comment from a repository
func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int64) (*Response, error)

Commit Status Operations

Create and List Statuses

// CreateStatus creates a new status for a repository at the specified reference
func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error)

// ListStatuses lists the statuses of a repository at the specified reference
func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref string, opts *ListOptions) ([]*RepoStatus, *Response, error)

// GetCombinedStatus returns the combined status of a repository at the specified reference
func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo, ref string, opts *ListOptions) (*CombinedStatus, *Response, error)

Collaborator Operations

// ListCollaborators lists GitHub users that have access to the repository
func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opts *ListCollaboratorsOptions) ([]*User, *Response, error)

// IsCollaborator checks whether the specified GitHub user has collaborator access
func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error)

// GetPermissionLevel retrieves the specific permission level a collaborator has
func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, repo, user string) (*RepositoryPermissionLevel, *Response, error)

// AddCollaborator sends an invitation to the specified GitHub user to become a collaborator
func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, opts *RepositoryAddCollaboratorOptions) (*CollaboratorInvitation, *Response, error)

// RemoveCollaborator removes the specified GitHub user as collaborator
func (s *RepositoriesService) RemoveCollaborator(ctx context.Context, owner, repo, user string) (*Response, error)

Repository Invitations

// ListInvitations lists all currently-open repository invitations
func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryInvitation, *Response, error)

// UpdateInvitation updates the permissions associated with a repository invitation
func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo string, invitationID int64, permissions string) (*RepositoryInvitation, *Response, error)

// DeleteInvitation deletes a repository invitation
func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo string, invitationID int64) (*Response, error)

Deploy Keys

// ListKeys lists the deploy keys for a repository
func (s *RepositoriesService) ListKeys(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Key, *Response, error)

// GetKey fetches a single deploy key
func (s *RepositoriesService) GetKey(ctx context.Context, owner, repo string, id int64) (*Key, *Response, error)

// CreateKey adds a deploy key for a repository
func (s *RepositoriesService) CreateKey(ctx context.Context, owner, repo string, key *Key) (*Key, *Response, error)

// DeleteKey deletes a deploy key
func (s *RepositoriesService) DeleteKey(ctx context.Context, owner, repo string, id int64) (*Response, error)

Repository Webhooks

Webhook Operations

// ListHooks lists all Hooks for the specified repository
func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Hook, *Response, error)

// GetHook returns a single specified Hook
func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error)

// CreateHook creates a Hook for the specified repository
func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error)

// EditHook updates a specified Hook
func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error)

// DeleteHook deletes a specified Hook
func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error)

// PingHook triggers a 'ping' event to be sent to the Hook
func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error)

// TestHook triggers a test Hook by GitHub
func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error)

Webhook Configuration

// GetHookConfiguration returns the configuration for the specified repository webhook
func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, repo string, id int64) (*HookConfig, *Response, error)

// EditHookConfiguration updates the configuration for the specified repository webhook
func (s *RepositoriesService) EditHookConfiguration(ctx context.Context, owner, repo string, id int64, config *HookConfig) (*HookConfig, *Response, error)

Webhook Deliveries

// ListHookDeliveries lists webhook deliveries for a webhook configured in a repository
func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, repo string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error)

// GetHookDelivery returns a delivery for a webhook configured in a repository
func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error)

// RedeliverHookDelivery redelivers a delivery for a webhook configured in a repository
func (s *RepositoriesService) RedeliverHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error)

WebSub (PubSubHubbub) Subscriptions

// Subscribe lets servers register to receive updates when a topic is updated
func (s *RepositoriesService) Subscribe(ctx context.Context, owner, repo, event, callback string, secret []byte) (*Response, error)

// Unsubscribe lets servers unregister to no longer receive updates when a topic is updated
func (s *RepositoriesService) Unsubscribe(ctx context.Context, owner, repo, event, callback string, secret []byte) (*Response, error)

Pre-Receive Hooks (GitHub Enterprise Server)

// ListPreReceiveHooks lists all pre-receive hooks for the specified repository
func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PreReceiveHook, *Response, error)

// GetPreReceiveHook returns a single specified pre-receive hook
func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo string, id int64) (*PreReceiveHook, *Response, error)

// UpdatePreReceiveHook updates a specified pre-receive hook
func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, hook *PreReceiveHook) (*PreReceiveHook, *Response, error)

// DeletePreReceiveHook deletes a specified pre-receive hook
func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, repo string, id int64) (*Response, error)

Releases

Release Operations

// ListReleases lists the releases for a repository
func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryRelease, *Response, error)

// GetRelease fetches a single release
func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error)

// GetLatestRelease fetches the latest published release for the repository
func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error)

// GetReleaseByTag fetches a release with the specified tag
func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error)

// CreateRelease adds a new release for a repository
func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error)

// EditRelease edits a repository release
func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, release *RepositoryRelease) (*RepositoryRelease, *Response, error)

// DeleteRelease deletes a single release from a repository
func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error)

Release Assets

// ListReleaseAssets lists the release's assets
func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*ReleaseAsset, *Response, error)

// GetReleaseAsset fetches a single release asset
func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error)

// UploadReleaseAsset creates an asset by uploading a file into a release repository
func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opts *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error)

// EditReleaseAsset edits a repository release asset
func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error)

// DeleteReleaseAsset deletes a single release asset from a repository
func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error)

// DownloadReleaseAsset downloads a release asset or returns a redirect URL
func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64, maxRedirects int) (io.ReadCloser, string, error)

Generate Release Notes

// GenerateReleaseNotes generates the release notes for the given tag
func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, opts *GenerateNotesOptions) (*RepositoryReleaseNotes, *Response, error)

Deployments

Deployment Operations

// ListDeployments lists the deployments of a repository
func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo string, opts *DeploymentsListOptions) ([]*Deployment, *Response, error)

// GetDeployment returns a single deployment of a repository
func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Deployment, *Response, error)

// CreateDeployment creates a new deployment for a repository
func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error)

// DeleteDeployment deletes an existing deployment for a repository
func (s *RepositoriesService) DeleteDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Response, error)

Deployment Status

// ListDeploymentStatuses lists the statuses of a given deployment
func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deploymentID int64, opts *ListOptions) ([]*DeploymentStatus, *Response, error)

// GetDeploymentStatus returns a single deployment status of a repository
func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int64) (*DeploymentStatus, *Response, error)

// CreateDeploymentStatus creates a new status for a deployment
func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deploymentID int64, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error)

Environments

Environment Operations

// ListEnvironments lists all environments for a repository
func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo string, opts *EnvironmentListOptions) (*EnvResponse, *Response, error)

// GetEnvironment gets a single environment for a repository
func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, name string) (*Environment, *Response, error)

// CreateUpdateEnvironment creates or updates an environment for a repository
func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner, repo, name string, environment *CreateUpdateEnvironment) (*Environment, *Response, error)

// DeleteEnvironment deletes an environment from a repository
func (s *RepositoriesService) DeleteEnvironment(ctx context.Context, owner, repo, name string) (*Response, error)

Deployment Branch Policies

// ListDeploymentBranchPolicies lists the deployment branch policies for an environment
func (s *RepositoriesService) ListDeploymentBranchPolicies(ctx context.Context, owner, repo, environment string, opts *ListOptions) (*DeploymentBranchPolicyResponse, *Response, error)

// GetDeploymentBranchPolicy gets a deployment branch policy for an environment
func (s *RepositoriesService) GetDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64) (*DeploymentBranchPolicy, *Response, error)

// CreateDeploymentBranchPolicy creates a deployment branch policy for an environment
func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, request *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error)

// UpdateDeploymentBranchPolicy updates a deployment branch policy for an environment
func (s *RepositoriesService) UpdateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64, request *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error)

// DeleteDeploymentBranchPolicy deletes a deployment branch policy for an environment
func (s *RepositoriesService) DeleteDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64) (*Response, error)

Deployment Protection Rules

// GetAllDeploymentProtectionRules gets all deployment protection rules for an environment
func (s *RepositoriesService) GetAllDeploymentProtectionRules(ctx context.Context, owner, repo, environment string) (*DeploymentProtectionRuleResponse, *Response, error)

// GetCustomDeploymentProtectionRule gets a custom deployment protection rule
func (s *RepositoriesService) GetCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, protectionRuleID int64) (*CustomDeploymentProtectionRule, *Response, error)

// CreateCustomDeploymentProtectionRule creates a custom deployment protection rule
func (s *RepositoriesService) CreateCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, request *CustomDeploymentProtectionRuleRequest) (*CustomDeploymentProtectionRule, *Response, error)

// DisableCustomDeploymentProtectionRule disables a custom deployment protection rule
func (s *RepositoriesService) DisableCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, protectionRuleID int64) (*Response, error)

// ListCustomDeploymentRuleIntegrations lists custom deployment rule integrations
func (s *RepositoriesService) ListCustomDeploymentRuleIntegrations(ctx context.Context, owner, repo, environment string, opts *ListOptions) (*CustomDeploymentProtectionRuleIntegrations, *Response, error)

GitHub Pages

// GetPagesInfo fetches information about a GitHub Pages site
func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo string) (*Pages, *Response, error)

// EnablePages enables GitHub Pages for the named repo
func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo string, pages *Pages) (*Pages, *Response, error)

// UpdatePages updates GitHub Pages for the named repo
func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, opts *PagesUpdate) (*Response, error)

// UpdatePagesGHES updates GitHub Pages for the named repo in GitHub Enterprise Servers
func (s *RepositoriesService) UpdatePagesGHES(ctx context.Context, owner, repo string, opts *PagesUpdateWithoutCNAME) (*Response, error)

// DisablePages disables GitHub Pages for the named repo
func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo string) (*Response, error)

// RequestPageBuild requests a build of a GitHub Pages site
func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error)

// ListPagesBuilds lists the builds for a GitHub Pages site
func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PagesBuild, *Response, error)

// GetLatestPagesBuild fetches the latest build information for a GitHub pages site
func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error)

// GetPageBuild fetches the specific build information for a GitHub pages site
func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int64) (*PagesBuild, *Response, error)

// GetPageHealthCheck gets a DNS health check for the CNAME record configured for a repository's GitHub Pages
func (s *RepositoriesService) GetPageHealthCheck(ctx context.Context, owner, repo string) (*PagesHealthCheckResponse, *Response, error)

Repository Statistics

Traffic Statistics

// ListTrafficReferrers lists the top 10 referrers over the last 14 days
func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, repo string) ([]*TrafficReferrer, *Response, error)

// ListTrafficPaths lists the top 10 popular content over the last 14 days
func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo string) ([]*TrafficPath, *Response, error)

// ListTrafficViews gets total number of views for the last 14 days
func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficViews, *Response, error)

// ListTrafficClones gets total number of clones for the last 14 days
func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficClones, *Response, error)

Contribution Statistics

// ListContributors lists contributors for a repository
func (s *RepositoriesService) ListContributors(ctx context.Context, owner, repo string, opts *ListContributorsOptions) ([]*Contributor, *Response, error)

// ListContributorsStats gets a repo's contributor list with additions, deletions, and commit counts
func (s *RepositoriesService) ListContributorsStats(ctx context.Context, owner, repo string) ([]*ContributorStats, *Response, error)

// ListCommitActivity returns the last year of commit activity grouped by week
func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, repo string) ([]*WeeklyCommitActivity, *Response, error)

// ListCodeFrequency returns a weekly aggregate of the number of additions and deletions
func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo string) ([]*WeeklyStats, *Response, error)

// ListParticipation returns the total commit counts for the 'owner' and total commit counts in all
func (s *RepositoriesService) ListParticipation(ctx context.Context, owner, repo string) (*RepositoryParticipation, *Response, error)

// ListPunchCard returns the number of commits per hour in each day
func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo string) ([]*PunchCard, *Response, error)

Repository Topics

// ListAllTopics lists topics for a repository
func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string) ([]string, *Response, error)

// ReplaceAllTopics replaces all repository topics
func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo string, topics []string) ([]string, *Response, error)

Repository Teams

// ListTeams lists the teams for the specified repository
func (s *RepositoriesService) ListTeams(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Team, *Response, error)

Repository Forks

// ListForks lists the forks of the specified repository
func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opts *RepositoryListForksOptions) ([]*Repository, *Response, error)

// MergeUpstream syncs a branch of a forked repository to keep it up-to-date with the upstream repository
func (s *RepositoriesService) MergeUpstream(ctx context.Context, owner, repo, branch string) (*RepoMergeUpstreamResult, *Response, error)

Repository Languages

// ListLanguages lists languages for the specified repository
func (s *RepositoriesService) ListLanguages(ctx context.Context, owner, repo string) (map[string]int, *Response, error)

Repository Tags

// ListTags lists tags for the specified repository
func (s *RepositoriesService) ListTags(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryTag, *Response, error)

// ListTagProtection lists tag protection of the specified repository
func (s *RepositoriesService) ListTagProtection(ctx context.Context, owner, repo string) ([]*TagProtection, *Response, error)

// CreateTagProtection creates tag protection for a repository
func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, repo string, pattern string) (*TagProtection, *Response, error)

// DeleteTagProtection deletes tag protection from the specified repository
func (s *RepositoriesService) DeleteTagProtection(ctx context.Context, owner, repo string, tagProtectionID int64) (*Response, error)

Repository Rulesets

// GetAllRulesets gets all the repository rulesets for the specified repository
func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo string, includesParents bool) ([]*Ruleset, *Response, error)

// GetRuleset gets a repository ruleset for the specified repository
func (s *RepositoriesService) GetRuleset(ctx context.Context, owner, repo string, rulesetID int64, includesParents bool) (*Ruleset, *Response, error)

// CreateRuleset creates a repository ruleset for the specified repository
func (s *RepositoriesService) CreateRuleset(ctx context.Context, owner, repo string, ruleset *Ruleset) (*Ruleset, *Response, error)

// UpdateRuleset updates a repository ruleset for the specified repository
func (s *RepositoriesService) UpdateRuleset(ctx context.Context, owner, repo string, rulesetID int64, ruleset *Ruleset) (*Ruleset, *Response, error)

// UpdateRulesetClearBypassActor clears the bypass actors for a repository ruleset
func (s *RepositoriesService) UpdateRulesetClearBypassActor(ctx context.Context, owner, repo string, rulesetID int64) (*Response, error)

// UpdateRulesetNoBypassActor updates a repository ruleset without omitting bypass actors
func (s *RepositoriesService) UpdateRulesetNoBypassActor(ctx context.Context, owner, repo string, rulesetID int64, ruleset *Ruleset) (*Ruleset, *Response, error)

// DeleteRuleset deletes a repository ruleset for the specified repository
func (s *RepositoriesService) DeleteRuleset(ctx context.Context, owner, repo string, rulesetID int64) (*Response, error)

// GetRulesForBranch gets all the repository rules that apply to the specified branch
func (s *RepositoriesService) GetRulesForBranch(ctx context.Context, owner, repo, branch string) ([]*RepositoryRule, *Response, error)

GitHub Actions Settings

// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions
func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, repo string) (*ActionsPermissions, *Response, error)

// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions
func (s *RepositoriesService) UpdateActionsPermissions(ctx context.Context, owner, repo string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error)

// GetActionsAllowed gets the allowed actions and reusable workflows for a repository
func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, owner, repo string) (*ActionsAllowed, *Response, error)

// EditActionsAllowed sets the allowed actions and reusable workflows for a repository
func (s *RepositoriesService) EditActionsAllowed(ctx context.Context, owner, repo string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error)

// GetActionsAccessLevel gets the level of access that workflows outside of the repository have
func (s *RepositoriesService) GetActionsAccessLevel(ctx context.Context, owner, repo string) (*RepositoryActionsAccessLevel, *Response, error)

// EditActionsAccessLevel sets the level of access that workflows outside of the repository have
func (s *RepositoriesService) EditActionsAccessLevel(ctx context.Context, owner, repo string, repositoryActionsAccessLevel RepositoryActionsAccessLevel) (*RepositoryActionsAccessLevel, *Response, error)

// GetDefaultWorkflowPermissions gets the GitHub Actions default workflow permissions
func (s *RepositoriesService) GetDefaultWorkflowPermissions(ctx context.Context, owner, repo string) (*DefaultWorkflowPermissionRepository, *Response, error)

// UpdateDefaultWorkflowPermissions sets the GitHub Actions default workflow permissions
func (s *RepositoriesService) UpdateDefaultWorkflowPermissions(ctx context.Context, owner, repo string, permissions DefaultWorkflowPermissionRepository) (*DefaultWorkflowPermissionRepository, *Response, error)

// GetArtifactAndLogRetentionPeriod gets the artifact and log retention period for a repository
func (s *RepositoriesService) GetArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string) (*ArtifactAndLogRetentionPeriod, *Response, error)

// UpdateArtifactAndLogRetentionPeriod sets the artifact and log retention period for a repository
func (s *RepositoriesService) UpdateArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string, period *ArtifactAndLogRetentionPeriod) (*ArtifactAndLogRetentionPeriod, *Response, error)

// GetPrivateRepoForkPRWorkflowSettings gets settings for whether workflows can run on pull requests from forks
func (s *RepositoriesService) GetPrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string) (*PrivateRepoForkPRWorkflowSettings, *Response, error)

// UpdatePrivateRepoForkPRWorkflowSettings sets settings for whether workflows can run on pull requests from forks
func (s *RepositoriesService) UpdatePrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, settings *PrivateRepoForkPRWorkflowSettings) (*PrivateRepoForkPRWorkflowSettings, *Response, error)

Security Features

Vulnerability Alerts

// GetVulnerabilityAlerts checks if vulnerability alerts are enabled for a repository
func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, repo string) (bool, *Response, error)

// EnableVulnerabilityAlerts enables vulnerability alerts and the dependency graph
func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, owner, repo string) (*Response, error)

// DisableVulnerabilityAlerts disables vulnerability alerts and the dependency graph
func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, owner, repo string) (*Response, error)

Automated Security Fixes

// GetAutomatedSecurityFixes checks if automated security fixes are enabled for a repository
func (s *RepositoriesService) GetAutomatedSecurityFixes(ctx context.Context, owner, repo string) (*AutomatedSecurityFixes, *Response, error)

// EnableAutomatedSecurityFixes enables automated security fixes for a repository
func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, owner, repo string) (*Response, error)

// DisableAutomatedSecurityFixes disables automated security fixes for a repository
func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, owner, repo string) (*Response, error)

Private Vulnerability Reporting

// EnablePrivateReporting enables private reporting of vulnerabilities for a repository
func (s *RepositoriesService) EnablePrivateReporting(ctx context.Context, owner, repo string) (*Response, error)

// DisablePrivateReporting disables private reporting of vulnerabilities for a repository
func (s *RepositoriesService) DisablePrivateReporting(ctx context.Context, owner, repo string) (*Response, error)

// IsPrivateReportingEnabled checks if private vulnerability reporting is enabled
func (s *RepositoriesService) IsPrivateReportingEnabled(ctx context.Context, owner, repo string) (bool, *Response, error)

Other Repository Operations

Repository Dispatch

// Dispatch triggers a repository_dispatch event in a GitHub Actions workflow
func (s *RepositoriesService) Dispatch(ctx context.Context, owner, repo string, opts DispatchRequestOptions) (*Response, error)

Merge Operations

// Merge a branch in the specified repository
func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error)

Autolinks

// ListAutolinks returns a list of autolinks configured for the repository
func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Autolink, *Response, error)

// GetAutolink returns a single autolink reference by ID
func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo string, id int64) (*Autolink, *Response, error)

// AddAutolink creates an autolink reference for a repository
func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo string, opts *AutolinkOptions) (*Autolink, *Response, error)

// DeleteAutolink deletes a single autolink reference by ID
func (s *RepositoriesService) DeleteAutolink(ctx context.Context, owner, repo string, id int64) (*Response, error)

Repository License

// License gets the contents of a repository's license
func (s *RepositoriesService) License(ctx context.Context, owner, repo string) (*RepositoryLicense, *Response, error)

Repository Code of Conduct

// GetCodeOfConduct gets the contents of a repository's code of conduct
func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo string) (*CodeOfConduct, *Response, error)

Community Health Metrics

// GetCommunityHealthMetrics retrieves all community health metrics for a repository
func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, owner, repo string) (*CommunityHealthMetrics, *Response, error)

CODEOWNERS Errors

// GetCodeownersErrors lists syntax errors detected in the CODEOWNERS file
func (s *RepositoriesService) GetCodeownersErrors(ctx context.Context, owner, repo string) (*CodeownersErrors, *Response, error)

Repository Activities

// ListRepositoryActivities lists the activities for a repository
func (s *RepositoriesService) ListRepositoryActivities(ctx context.Context, owner, repo string, opts *ListRepositoryActivityOptions) ([]*RepositoryActivity, *Response, error)

Custom Properties

// GetAllCustomPropertyValues gets all custom property values that are set for a repository
func (s *RepositoriesService) GetAllCustomPropertyValues(ctx context.Context, owner, repo string) ([]*RepoCustomPropertyValue, *Response, error)

// CreateOrUpdateCustomProperties creates new or updates existing custom properties for a repository
func (s *RepositoriesService) CreateOrUpdateCustomProperties(ctx context.Context, owner, repo string, properties []*RepoCustomPropertyValue) (*Response, error)

LFS (Large File Storage)

// EnableLFS turns the LFS feature ON for the selected repository
func (s *RepositoriesService) EnableLFS(ctx context.Context, owner, repo string) (*Response, error)

// DisableLFS turns the LFS feature OFF for the selected repository
func (s *RepositoriesService) DisableLFS(ctx context.Context, owner, repo string) (*Response, error)

Attestations

// ListAttestations returns a collection of artifact attestations with a given subject digest
func (s *RepositoriesService) ListAttestations(ctx context.Context, owner, repo, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error)

Key Types

Repository

type Repository struct {
    ID                        *int64          `json:"id,omitempty"`
    NodeID                    *string         `json:"node_id,omitempty"`
    Owner                     *User           `json:"owner,omitempty"`
    Name                      *string         `json:"name,omitempty"`
    FullName                  *string         `json:"full_name,omitempty"`
    Description               *string         `json:"description,omitempty"`
    Homepage                  *string         `json:"homepage,omitempty"`
    CodeOfConduct             *CodeOfConduct  `json:"code_of_conduct,omitempty"`
    DefaultBranch             *string         `json:"default_branch,omitempty"`
    MasterBranch              *string         `json:"master_branch,omitempty"`
    CreatedAt                 *Timestamp      `json:"created_at,omitempty"`
    PushedAt                  *Timestamp      `json:"pushed_at,omitempty"`
    UpdatedAt                 *Timestamp      `json:"updated_at,omitempty"`
    HTMLURL                   *string         `json:"html_url,omitempty"`
    CloneURL                  *string         `json:"clone_url,omitempty"`
    GitURL                    *string         `json:"git_url,omitempty"`
    MirrorURL                 *string         `json:"mirror_url,omitempty"`
    SSHURL                    *string         `json:"ssh_url,omitempty"`
    SVNURL                    *string         `json:"svn_url,omitempty"`
    Language                  *string         `json:"language,omitempty"`
    Fork                      *bool           `json:"fork,omitempty"`
    ForksCount                *int            `json:"forks_count,omitempty"`
    NetworkCount              *int            `json:"network_count,omitempty"`
    OpenIssuesCount           *int            `json:"open_issues_count,omitempty"`
    OpenIssues                *int            `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount
    StargazersCount           *int            `json:"stargazers_count,omitempty"`
    SubscribersCount          *int            `json:"subscribers_count,omitempty"`
    WatchersCount             *int            `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount
    Watchers                  *int            `json:"watchers,omitempty"`       // Deprecated: Replaced by StargazersCount
    Size                      *int            `json:"size,omitempty"`
    AutoInit                  *bool           `json:"auto_init,omitempty"`
    Parent                    *Repository     `json:"parent,omitempty"`
    Source                    *Repository     `json:"source,omitempty"`
    TemplateRepository        *Repository     `json:"template_repository,omitempty"`
    Organization              *Organization   `json:"organization,omitempty"`
    Permissions               map[string]bool `json:"permissions,omitempty"`
    AllowRebaseMerge          *bool           `json:"allow_rebase_merge,omitempty"`
    AllowUpdateBranch         *bool           `json:"allow_update_branch,omitempty"`
    AllowSquashMerge          *bool           `json:"allow_squash_merge,omitempty"`
    AllowMergeCommit          *bool           `json:"allow_merge_commit,omitempty"`
    AllowAutoMerge            *bool           `json:"allow_auto_merge,omitempty"`
    AllowForking              *bool           `json:"allow_forking,omitempty"`
    WebCommitSignoffRequired  *bool           `json:"web_commit_signoff_required,omitempty"`
    DeleteBranchOnMerge       *bool           `json:"delete_branch_on_merge,omitempty"`
    UseSquashPRTitleAsDefault *bool           `json:"use_squash_pr_title_as_default,omitempty"`
    SquashMergeCommitTitle    *string         `json:"squash_merge_commit_title,omitempty"`   // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE"
    SquashMergeCommitMessage  *string         `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK"
    MergeCommitTitle          *string         `json:"merge_commit_title,omitempty"`          // Can be one of: "PR_TITLE", "MERGE_MESSAGE"
    MergeCommitMessage        *string         `json:"merge_commit_message,omitempty"`        // Can be one of: "PR_BODY", "PR_TITLE", "BLANK"
    Topics                    []string        `json:"topics,omitempty"`
    CustomProperties          map[string]any  `json:"custom_properties,omitempty"`
    Archived                  *bool           `json:"archived,omitempty"`
    Disabled                  *bool           `json:"disabled,omitempty"`
    License                   *License        `json:"license,omitempty"` // Only provided when using RepositoriesService.Get
    Private                   *bool           `json:"private,omitempty"`
    HasIssues                 *bool           `json:"has_issues,omitempty"`
    HasWiki                   *bool           `json:"has_wiki,omitempty"`
    HasPages                  *bool           `json:"has_pages,omitempty"`
    HasProjects               *bool           `json:"has_projects,omitempty"`
    HasDownloads              *bool           `json:"has_downloads,omitempty"`
    HasDiscussions            *bool           `json:"has_discussions,omitempty"`
    IsTemplate                *bool           `json:"is_template,omitempty"`
    LicenseTemplate           *string         `json:"license_template,omitempty"`
    GitignoreTemplate         *string         `json:"gitignore_template,omitempty"`
    SecurityAndAnalysis       *SecurityAndAnalysis `json:"security_and_analysis,omitempty"`
    TeamID                    *int64          `json:"team_id,omitempty"` // Creating an organization repository, required for non-owners
    URL                       *string         `json:"url,omitempty"`
    ArchiveURL                *string         `json:"archive_url,omitempty"`
    AssigneesURL              *string         `json:"assignees_url,omitempty"`
    BlobsURL                  *string         `json:"blobs_url,omitempty"`
    BranchesURL               *string         `json:"branches_url,omitempty"`
    CollaboratorsURL          *string         `json:"collaborators_url,omitempty"`
    CommentsURL               *string         `json:"comments_url,omitempty"`
    CommitsURL                *string         `json:"commits_url,omitempty"`
    CompareURL                *string         `json:"compare_url,omitempty"`
    ContentsURL               *string         `json:"contents_url,omitempty"`
    ContributorsURL           *string         `json:"contributors_url,omitempty"`
    DeploymentsURL            *string         `json:"deployments_url,omitempty"`
    DownloadsURL              *string         `json:"downloads_url,omitempty"`
    EventsURL                 *string         `json:"events_url,omitempty"`
    ForksURL                  *string         `json:"forks_url,omitempty"`
    GitCommitsURL             *string         `json:"git_commits_url,omitempty"`
    GitRefsURL                *string         `json:"git_refs_url,omitempty"`
    GitTagsURL                *string         `json:"git_tags_url,omitempty"`
    HooksURL                  *string         `json:"hooks_url,omitempty"`
    IssueCommentURL           *string         `json:"issue_comment_url,omitempty"`
    IssueEventsURL            *string         `json:"issue_events_url,omitempty"`
    IssuesURL                 *string         `json:"issues_url,omitempty"`
    KeysURL                   *string         `json:"keys_url,omitempty"`
    LabelsURL                 *string         `json:"labels_url,omitempty"`
    LanguagesURL              *string         `json:"languages_url,omitempty"`
    MergesURL                 *string         `json:"merges_url,omitempty"`
    MilestonesURL             *string         `json:"milestones_url,omitempty"`
    NotificationsURL          *string         `json:"notifications_url,omitempty"`
    PullsURL                  *string         `json:"pulls_url,omitempty"`
    ReleasesURL               *string         `json:"releases_url,omitempty"`
    StargazersURL             *string         `json:"stargazers_url,omitempty"`
    StatusesURL               *string         `json:"statuses_url,omitempty"`
    SubscribersURL            *string         `json:"subscribers_url,omitempty"`
    SubscriptionURL           *string         `json:"subscription_url,omitempty"`
    TagsURL                   *string         `json:"tags_url,omitempty"`
    TreesURL                  *string         `json:"trees_url,omitempty"`
    TeamsURL                  *string         `json:"teams_url,omitempty"`
    TextMatches               []*TextMatch    `json:"text_matches,omitempty"` // Only populated from search results
    Visibility                *string         `json:"visibility,omitempty"` // Can be one of public, private or internal
    RoleName                  *string         `json:"role_name,omitempty"` // Only returned by API 'check team permissions for a repository'
}

RepositoryContent

type RepositoryContent struct {
    Type            *string
    Encoding        *string
    Size            *int
    Name            *string
    Path            *string
    Content         *string
    SHA             *string
    URL             *string
    GitURL          *string
    HTMLURL         *string
    DownloadURL     *string
    Target          *string
    SubmoduleGitURL *string
}

// GetContent returns decoded file content
func (r *RepositoryContent) GetContent() (string, error)

RepositoryContentFileOptions

type RepositoryContentFileOptions struct {
    Message   *string
    Content   []byte
    SHA       *string
    Branch    *string
    Author    *CommitAuthor
    Committer *CommitAuthor
}

Branch

type Branch struct {
    Name          *string
    Commit        *RepositoryCommit
    Protected     *bool
    Protection    *Protection
    ProtectionURL *string
}

Protection

type Protection struct {
    RequiredStatusChecks       *RequiredStatusChecks
    RequiredPullRequestReviews *PullRequestReviewsEnforcement
    EnforceAdmins              *AdminEnforcement
    Restrictions               *BranchRestrictions
    RequireLinearHistory       *RequireLinearHistory
    AllowForcePushes           *AllowForcePushes
    AllowDeletions             *AllowDeletions
    BlockCreations             *BlockCreations
    RequiredConversationResolution *RequiredConversationResolution
    RequiredSignatures         *SignaturesProtectedBranch
    LockBranch                 *LockBranch
    AllowForkSyncing           *AllowForkSyncing
}

RepositoryCommit

type RepositoryCommit struct {
    NodeID       *string
    SHA          *string
    Commit       *Commit
    Author       *User
    Committer    *User
    Parents      []*Commit
    HTMLURL      *string
    URL          *string
    CommentsURL  *string
    Stats        *CommitStats
    Files        []*CommitFile
}

RepositoryRelease

type RepositoryRelease struct {
    ID              *int64
    TagName         *string
    TargetCommitish *string
    Name            *string
    Body            *string
    Draft           *bool
    Prerelease      *bool
    CreatedAt       *Timestamp
    PublishedAt     *Timestamp
    URL             *string
    HTMLURL         *string
    AssetsURL       *string
    Assets          []*ReleaseAsset
    UploadURL       *string
    ZipballURL      *string
    TarballURL      *string
    Author          *User
    NodeID          *string
}

Hook

type Hook struct {
    ID        *int64
    Type      *string
    Name      *string
    Active    *bool
    Events    []string
    Config    *HookConfig
    UpdatedAt *Timestamp
    CreatedAt *Timestamp
    URL       *string
    TestURL   *string
    PingURL   *string
    LastResponse map[string]interface{}
}

type HookConfig struct {
    ContentType *string
    InsecureSSL *string
    URL         *string
    Secret      *string
}

Deployment

type Deployment struct {
    URL                   *string
    ID                    *int64
    NodeID                *string
    SHA                   *string
    Ref                   *string
    Task                  *string
    Payload               *DeploymentPayload
    OriginalEnvironment   *string
    Environment           *string
    Description           *string
    Creator               *User
    CreatedAt             *Timestamp
    UpdatedAt             *Timestamp
    StatusesURL           *string
    RepositoryURL         *string
    TransientEnvironment  *bool
    ProductionEnvironment *bool
}

Environment

type Environment struct {
    ID                  *int64
    NodeID              *string
    Name                *string
    URL                 *string
    HTMLURL             *string
    CreatedAt           *Timestamp
    UpdatedAt           *Timestamp
    ProtectionRules     []*ProtectionRule
    DeploymentBranchPolicy *BranchPolicy
}

List Options Types

type RepositoryListOptions struct {
    Visibility  string
    Affiliation string
    Type        string
    Sort        string
    Direction   string
    ListOptions
}

type RepositoryListByOrgOptions struct {
    Type        string
    Sort        string
    Direction   string
    ListOptions
}

type RepositoryListByAuthenticatedUserOptions struct {
    Visibility  string
    Affiliation string
    Type        string
    Sort        string
    Direction   string
    Since       time.Time
    Before      time.Time
    ListOptions
}

type CommitsListOptions struct {
    SHA     string
    Path    string
    Author  string
    Committer string
    Since   time.Time
    Until   time.Time
    ListOptions
}

type BranchListOptions struct {
    Protected *bool
    ListOptions
}