Documentation
¶
Index ¶
- Constants
- Variables
- func DetectWorkflows(gitRepo *git.Repository, commit *git.Commit, ...) ([]*DetectedWorkflow, []*DetectedWorkflow, error)
- func DownloadArtifactV4(ctx *context.Base, art *actions_model.ActionArtifact) error
- func DownloadArtifactV4Fallback(ctx *context.Base, art *actions_model.ActionArtifact) error
- func DownloadArtifactV4ServeDirectOnly(ctx *context.Base, art *actions_model.ActionArtifact) (bool, error)
- func FormatLog(timestamp time.Time, content string) string
- func FullSteps(task *actions_model.ActionTask) []*actions_model.ActionTaskStep
- func GetContentFromEntry(entry *git.TreeEntry) ([]byte, error)
- func GetEventsFromContent(content []byte) ([]*jobparser.Event, error)
- func GetIncompatibilityMessage(actionWithVersion string) string
- func GetSuggestedAlternative(actionWithVersion string) string
- func IsActionCompatible(actionWithVersion string) bool
- func IsArtifactV4(art *actions_model.ActionArtifact) bool
- func IsDefaultBranchWorkflow(triggedEvent webhook_module.HookEventType) bool
- func IsWorkflow(path string) bool
- func ListWorkflows(commit *git.Commit) (string, git.Entries, error)
- func OpenLogs(ctx context.Context, inStorage bool, filename string) (io.ReadSeekCloser, error)
- func ParseLog(in string) (time.Time, string, error)
- func ReadLogs(ctx context.Context, inStorage bool, filename string, offset, limit int64) ([]*runnerv1.LogRow, error)
- func RemoveLogs(ctx context.Context, inStorage bool, filename string) error
- func TransferLogs(ctx context.Context, filename string) (func(), error)
- func WriteLogs(ctx context.Context, filename string, offset int64, rows []*runnerv1.LogRow) ([]int, error)
- type ActionCompatibility
- type CompatibilityStatus
- type DetectedWorkflow
Constants ¶
const ( GithubEventPullRequest = "pull_request" GithubEventPullRequestTarget = "pull_request_target" GithubEventPullRequestReviewComment = "pull_request_review_comment" GithubEventPullRequestReview = "pull_request_review" GithubEventRegistryPackage = "registry_package" GithubEventCreate = "create" GithubEventDelete = "delete" GithubEventFork = "fork" GithubEventPush = "push" GithubEventIssues = "issues" GithubEventIssueComment = "issue_comment" GithubEventRelease = "release" GithubEventPullRequestComment = "pull_request_comment" GithubEventGollum = "gollum" GithubEventSchedule = "schedule" )
const ( MaxLineSize = 64 * 1024 DBFSPrefix = "actions_log/" )
Variables ¶
var BuiltinCompatibility = map[string]*ActionCompatibility{ "actions/checkout": { Name: "actions/checkout", Versions: []string{"v2", "v3", "v4"}, Status: CompatibilityFull, Notes: "Fully compatible with Gitea Actions", }, "actions/setup-node": { Name: "actions/setup-node", Versions: []string{"v2", "v3", "v4"}, Status: CompatibilityFull, Notes: "Fully compatible with Gitea Actions", }, "actions/setup-go": { Name: "actions/setup-go", Versions: []string{"v3", "v4", "v5"}, Status: CompatibilityFull, Notes: "Fully compatible with Gitea Actions", }, "actions/setup-python": { Name: "actions/setup-python", Versions: []string{"v4", "v5"}, Status: CompatibilityFull, Notes: "Fully compatible with Gitea Actions", }, "actions/setup-java": { Name: "actions/setup-java", Versions: []string{"v3", "v4"}, Status: CompatibilityFull, Notes: "Fully compatible with Gitea Actions", }, "actions/setup-dotnet": { Name: "actions/setup-dotnet", Versions: []string{"v3", "v4"}, Status: CompatibilityFull, Notes: "Fully compatible with Gitea Actions", }, "actions/upload-artifact": { Name: "actions/upload-artifact", Versions: []string{"v2", "v3"}, Status: CompatibilityPartial, Notes: "v4 not supported on GHES-compatible runners. Use v3 or Gitea API for artifact upload.", Alternative: "actions/upload-artifact@v3 or direct Gitea API upload", }, "actions/download-artifact": { Name: "actions/download-artifact", Versions: []string{"v2", "v3"}, Status: CompatibilityPartial, Notes: "v4 not supported on GHES-compatible runners. Use v3.", Alternative: "actions/download-artifact@v3", }, "actions/cache": { Name: "actions/cache", Versions: []string{"v3", "v4"}, Status: CompatibilityFull, Notes: "Fully compatible with Gitea Actions", }, "actions/github-script": { Name: "actions/github-script", Versions: []string{"v6", "v7"}, Status: CompatibilityPartial, Notes: "GitHub API calls may not work. Use for basic scripting only.", }, }
BuiltinCompatibility contains known action compatibility information for Gitea Actions This is used by the capability discovery API to help AI tools write correct workflows
var IncompatibleActions = map[string]string{
"actions/upload-artifact@v4": "v4 not supported on Gitea/GHES-compatible runners. Use actions/upload-artifact@v3 or direct Gitea API upload.",
"actions/download-artifact@v4": "v4 not supported on Gitea/GHES-compatible runners. Use actions/download-artifact@v3.",
}
IncompatibleActions maps action@version to error messages
var UnsupportedFeatures = []string{
"GitHub-hosted runners",
"Environments with protection rules",
"OIDC token authentication",
"Required workflows",
"Deployment branches",
"Reusable workflows from other repositories (limited)",
"actions/upload-artifact@v4",
"actions/download-artifact@v4",
}
UnsupportedFeatures lists features that are not supported in Gitea Actions
Functions ¶
func DetectWorkflows ¶
func DetectWorkflows( gitRepo *git.Repository, commit *git.Commit, triggedEvent webhook_module.HookEventType, payload api.Payloader, detectSchedule bool, ) ([]*DetectedWorkflow, []*DetectedWorkflow, error)
func DownloadArtifactV4 ¶
func DownloadArtifactV4(ctx *context.Base, art *actions_model.ActionArtifact) error
func DownloadArtifactV4Fallback ¶
func DownloadArtifactV4Fallback(ctx *context.Base, art *actions_model.ActionArtifact) error
func DownloadArtifactV4ServeDirectOnly ¶
func DownloadArtifactV4ServeDirectOnly(ctx *context.Base, art *actions_model.ActionArtifact) (bool, error)
func FullSteps ¶
func FullSteps(task *actions_model.ActionTask) []*actions_model.ActionTaskStep
FullSteps returns steps with "Set up job" and "Complete job"
func GetIncompatibilityMessage ¶
GetIncompatibilityMessage returns an error message if the action@version is incompatible
func GetSuggestedAlternative ¶
GetSuggestedAlternative returns a suggested alternative for an incompatible action
func IsActionCompatible ¶
IsActionCompatible checks if an action@version is compatible with Gitea Actions
func IsArtifactV4 ¶
func IsArtifactV4(art *actions_model.ActionArtifact) bool
Artifacts using the v4 backend are stored as a single combined zip file per artifact on the backend The v4 backend ensures ContentEncoding is set to "application/zip", which is not the case for the old backend
func IsDefaultBranchWorkflow ¶
func IsDefaultBranchWorkflow(triggedEvent webhook_module.HookEventType) bool
IsDefaultBranchWorkflow returns true if the event only triggers workflows on the default branch
func OpenLogs ¶
func ReadLogs ¶
func TransferLogs ¶
TransferLogs transfers logs from DBFS to object storage. It happens when the file is complete and no more logs will be appended. It respects the file format in the filename like ".zst", and compresses the content if needed.
func WriteLogs ¶
func WriteLogs(ctx context.Context, filename string, offset int64, rows []*runnerv1.LogRow) ([]int, error)
WriteLogs appends logs to DBFS file for temporary storage. It doesn't respect the file format in the filename like ".zst", since it's difficult to reopen a closed compressed file and append new content. Why doesn't it store logs in object storage directly? Because it's not efficient to append content to object storage.
Types ¶
type ActionCompatibility ¶
type ActionCompatibility struct {
// Action name (e.g., "actions/checkout")
Name string
// Supported versions
Versions []string
// Compatibility status
Status CompatibilityStatus
// Notes about compatibility
Notes string
// Suggested alternative if not fully compatible
Alternative string
}
ActionCompatibility represents compatibility information for a GitHub action
func GetCompatibility ¶
func GetCompatibility(actionName string) *ActionCompatibility
GetCompatibility returns compatibility information for an action
type CompatibilityStatus ¶
type CompatibilityStatus string
CompatibilityStatus represents the support status of an action
const ( CompatibilityFull CompatibilityStatus = "full" CompatibilityPartial CompatibilityStatus = "partial" CompatibilityNone CompatibilityStatus = "none" )
Source Files
¶
- artifacts.go
- compatibility.go
- github.go
- log.go
- task_state.go
- workflows.go