common

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const AuthMethodApp = "app"
View Source
const AuthMethodPAT = "pat"
View Source
const GitHubAppClientSecret = "clientSecret"
View Source
const GitHubAppPEM = "pem"

* These are the legacy secrets

View Source
const GitHubAppWebhookSecret = "webhookSecret"
View Source
const OwnerTypeOrganization = "Organization"
View Source
const OwnerTypeUser = "User Account"
View Source
const PropertyAppClientID = "appClientID"
View Source
const PropertyAppID = "appID"

* When connecting to the owner with a GitHub App, * these are the properties we get back from GitHub, * through the app creation / installation flow.

View Source
const PropertyAppInstallationID = "appInstallationID"
View Source
const PropertyAppInstallationURL = "appInstallationURL"
View Source
const PropertyAppSlug = "appSlug"
View Source
const PropertyAppState = "appState"
View Source
const PropertyAppURL = "appURL"
View Source
const PropertyAuthMethod = "authMethod"

* Two authentication methods are supported: * - Personal Access Token (PAT) * - GitHub App

View Source
const PropertyOwner = "owner"
View Source
const PropertyOwnerType = "ownerType"

* An integration can be connected to: * - A user account * - An organization

View Source
const SecretAppClientSecret = "appClientSecret"
View Source
const SecretAppPEM = "appPEM"
View Source
const SecretAppWebhookSecret = "appWebhookSecret"
View Source
const SecretPAT = "pat"

* Secrets for the integration: * - Personal Access Token (PAT) * - GitHub App private key (App) * - GitHub App client secret (App) * - GitHub App webhook secret (App)

Variables

This section is empty.

Functions

func AppInstallationURL added in v0.20.0

func AppInstallationURL(properties core.IntegrationPropertyStorageReader, installationID string) (string, error)

func AppURL added in v0.20.0

func AppURL(properties core.IntegrationPropertyStorageReader, appSlug string) (string, error)

func EnsureRepoInMetadata

func EnsureRepoInMetadata(ctx core.MetadataWriter, integration core.IntegrationContext, httpCtx core.HTTPContext, configuration any) error

func ExtractAction

func ExtractAction(data map[string]any) (string, bool)

func FindSecret

func FindSecret(ctx core.IntegrationContext, secretName string) (string, error)

func IsExpression added in v0.20.0

func IsExpression(s string) bool

IsExpression reports whether the given string contains an expression placeholder (e.g. `{{ ... }}`). Useful in Setup paths to skip strict validation of values that will only be known at execution time.

func IsNotFoundError added in v0.20.0

func IsNotFoundError(err error) bool

func SanitizeAssignees

func SanitizeAssignees(assignees []string) []string

func VerifySignature

func VerifySignature(ctx core.WebhookRequestContext) (int, error)

func WhitelistedAction

func WhitelistedAction(data map[string]any, allowed []string) bool

func WithWebhookLogger

func WithWebhookLogger(ctx core.WebhookRequestContext, triggerName string) core.WebhookRequestContext

Types

type Client added in v0.20.0

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx core.IntegrationContext, httpCtx core.HTTPContext) (*Client, error)

func (*Client) AddIssueAssignees added in v0.20.0

func (c *Client) AddIssueAssignees(ctx context.Context, repository string, issueNumber int, assignees []string) (*github.Issue, *github.Response, error)

func (*Client) AddLabelsToIssue added in v0.20.0

func (c *Client) AddLabelsToIssue(ctx context.Context, repository string, issueNumber int, labels []string) ([]*github.Label, *github.Response, error)

func (*Client) CancelWorkflowRun added in v0.20.0

func (c *Client) CancelWorkflowRun(repository string, workflowRunID int64) (*github.Response, error)

func (*Client) CreateDeployment added in v0.21.0

func (c *Client) CreateDeployment(ctx context.Context, repository string, request *github.DeploymentRequest) (*github.Deployment, *github.Response, error)

func (*Client) CreateDeploymentStatus added in v0.21.0

func (c *Client) CreateDeploymentStatus(ctx context.Context, repository string, deploymentID int64, request *github.DeploymentStatusRequest) (*github.DeploymentStatus, *github.Response, error)

func (*Client) CreateHook added in v0.20.0

func (c *Client) CreateHook(ctx context.Context, repository string, hook *github.Hook) (*github.Hook, *github.Response, error)

func (*Client) CreateIssue added in v0.20.0

func (c *Client) CreateIssue(ctx context.Context, repository string, issue *github.IssueRequest) (*github.Issue, *github.Response, error)

func (*Client) CreateIssueComment added in v0.20.0

func (c *Client) CreateIssueComment(ctx context.Context, repository string, issueNumber int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)

func (*Client) CreateIssueReaction added in v0.20.0

func (c *Client) CreateIssueReaction(ctx context.Context, repository string, commentID int64, content string) (*github.Reaction, *github.Response, error)

func (*Client) CreatePullRequest added in v0.20.0

func (c *Client) CreatePullRequest(ctx context.Context, repository string, pullRequest *github.NewPullRequest) (*github.PullRequest, *github.Response, error)

func (*Client) CreatePullRequestReview added in v0.20.0

func (c *Client) CreatePullRequestReview(ctx context.Context, repository string, pullNumber int, review *github.PullRequestReviewRequest) (*github.PullRequestReview, *github.Response, error)

func (*Client) CreateRelease added in v0.20.0

func (c *Client) CreateRelease(ctx context.Context, repository string, release *github.RepositoryRelease) (*github.RepositoryRelease, *github.Response, error)

func (*Client) CreateReviewCommentReaction added in v0.20.0

func (c *Client) CreateReviewCommentReaction(ctx context.Context, repository string, commentID int64, content string) (*github.Reaction, *github.Response, error)

func (*Client) CreateStatus added in v0.20.0

func (c *Client) CreateStatus(ctx context.Context, repository string, sha string, status github.RepoStatus) (*github.RepoStatus, *github.Response, error)

func (*Client) CreateWorkflowDispatchEvent added in v0.20.0

func (c *Client) CreateWorkflowDispatchEvent(ctx context.Context, repository string, workflowFile string, request github.CreateWorkflowDispatchEventRequest) (*github.WorkflowDispatchRunDetails, *github.Response, error)

func (*Client) DeleteHook added in v0.20.0

func (c *Client) DeleteHook(ctx context.Context, repository string, hookID int64) (*github.Response, error)

func (*Client) DeleteRef added in v0.20.0

func (c *Client) DeleteRef(ctx context.Context, repository string, ref string) (*github.Response, error)

func (*Client) DeleteRelease added in v0.20.0

func (c *Client) DeleteRelease(ctx context.Context, repository string, id int64) (*github.Response, error)

func (*Client) EditIssue added in v0.20.0

func (c *Client) EditIssue(ctx context.Context, repository string, issueNumber int, issue *github.IssueRequest) (*github.Issue, *github.Response, error)

func (*Client) EditRelease added in v0.20.0

func (c *Client) EditRelease(ctx context.Context, repository string, id int64, release *github.RepositoryRelease) (*github.RepositoryRelease, *github.Response, error)

func (*Client) FindRepository added in v0.20.0

func (c *Client) FindRepository(repository string) (*github.Repository, error)

func (*Client) GenerateReleaseNotes added in v0.20.0

func (c *Client) GenerateReleaseNotes(ctx context.Context, repository string, options *github.GenerateNotesOptions) (*github.RepositoryReleaseNotes, *github.Response, error)

func (*Client) GetIssue added in v0.20.0

func (c *Client) GetIssue(ctx context.Context, repository string, issueNumber int) (*github.Issue, *github.Response, error)

func (*Client) GetLatestRelease added in v0.20.0

func (c *Client) GetLatestRelease(ctx context.Context, repository string) (*github.RepositoryRelease, *github.Response, error)

func (*Client) GetOrganizationUsageReport added in v0.20.0

func (c *Client) GetOrganizationUsageReport() (*github.UsageReport, *github.Response, error)

func (*Client) GetRef added in v0.20.0

func (c *Client) GetRef(repository string, ref string) (*github.Reference, *github.Response, error)

func (*Client) GetRelease added in v0.20.0

func (c *Client) GetRelease(ctx context.Context, repository string, id int64) (*github.RepositoryRelease, *github.Response, error)

func (*Client) GetReleaseByTag added in v0.20.0

func (c *Client) GetReleaseByTag(ctx context.Context, repository string, tag string) (*github.RepositoryRelease, *github.Response, error)

func (*Client) GetRepositoryPermissionLevel added in v0.20.0

func (c *Client) GetRepositoryPermissionLevel(ctx context.Context, repository string, username string) (*github.RepositoryPermissionLevel, *github.Response, error)

func (*Client) GetWorkflowRun added in v0.20.0

func (c *Client) GetWorkflowRun(repository string, workflowRunID int64) (*github.WorkflowRun, *github.Response, error)

func (*Client) ListBranches added in v0.20.0

func (c *Client) ListBranches(ctx context.Context, repository string, opts *github.BranchListOptions) ([]*github.Branch, *github.Response, error)

func (*Client) ListLabelsForIssue added in v0.20.0

func (c *Client) ListLabelsForIssue(ctx context.Context, repository string, issueNumber int) ([]*github.Label, *github.Response, error)

func (*Client) ListReleases added in v0.20.0

func (c *Client) ListReleases(ctx context.Context, repository string, options *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error)

func (*Client) ListRepositories added in v0.20.0

func (c *Client) ListRepositories() ([]*github.Repository, error)

func (*Client) RemoveIssueAssignees added in v0.20.0

func (c *Client) RemoveIssueAssignees(ctx context.Context, repository string, issueNumber int, assignees []string) (*github.Issue, *github.Response, error)

func (*Client) RemoveLabelForIssue added in v0.20.0

func (c *Client) RemoveLabelForIssue(ctx context.Context, repository string, issueNumber int, label string) (*github.Response, error)

type GitHubAppMetadata

type GitHubAppMetadata struct {
	ID       int64  `mapstructure:"id" json:"id"`
	Slug     string `mapstructure:"slug" json:"slug"`
	ClientID string `mapstructure:"clientId" json:"clientId"`
}

type Metadata

type Metadata struct {
	InstallationID string            `mapstructure:"installationId" json:"installationId"`
	State          string            `mapstructure:"state" json:"state"`
	Owner          string            `mapstructure:"owner" json:"owner"`
	Repositories   []Repository      `mapstructure:"repositories" json:"repositories"`
	GitHubApp      GitHubAppMetadata `mapstructure:"githubApp" json:"githubApp"`
}

type NodeMetadata

type NodeMetadata struct {
	Repository *Repository `json:"repository"`
}

type Repository

type Repository struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

type WebhookConfiguration

type WebhookConfiguration struct {
	EventType  string   `json:"eventType"`
	EventTypes []string `json:"eventTypes"` // Multiple event types (takes precedence over EventType if set)
	Repository string   `json:"repository"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL