gitlab

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectProjectForFile added in v0.3.0

func DetectProjectForFile(filePath string) (string, error)

DetectProjectForFile attempts to detect the GitLab project for a specific file It searches upward from the file's directory to find the git repository root Handles both regular git repos and git submodules

func DetectProjectFromGitRepo added in v0.3.0

func DetectProjectFromGitRepo(dir string) (string, error)

DetectProjectFromGitRepo attempts to detect the GitLab project path from a git repository It reads .git/config and extracts the project path from remote.origin.url Returns empty string if not a git repo or cannot determine the project

func ExtractTokenFromNetrc

func ExtractTokenFromNetrc(instance string) (string, error)

ExtractTokenFromNetrc attempts to find credentials for the given host in .netrc file

func NormalizeInstanceURL

func NormalizeInstanceURL(instance string) string

NormalizeInstanceURL ensures the instance URL has a proper format

Types

type APIError

type APIError struct {
	Message string `json:"message"`
}

APIError represents an error from the GitLab API

type Client

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

Client represents a GitLab API client

func NewClient

func NewClient(instance, token string, timeout time.Duration) *Client

NewClient creates a new GitLab API client

func (*Client) Lint

func (c *Client) Lint(ctx context.Context, content []byte, projectRef string) (*LintResponse, error)

Lint validates a CI configuration using the GitLab API

func (*Client) ValidateToken

func (c *Client) ValidateToken(ctx context.Context) error

ValidateToken checks if the current token is valid by making a simple API call

type LintRequest

type LintRequest struct {
	Content     string `json:"content"`
	DryRun      bool   `json:"dry_run,omitempty"`
	IncludeJobs bool   `json:"include_jobs,omitempty"`
}

LintRequest represents the request body for the GitLab CI lint API

type LintResponse

type LintResponse struct {
	Valid      bool       `json:"valid"`
	Errors     []APIError `json:"errors,omitempty"`
	Warnings   []string   `json:"warnings,omitempty"`
	MergedYaml string     `json:"merged_yaml,omitempty"`
}

LintResponse represents the response from the GitLab CI lint API

Jump to

Keyboard shortcuts

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