MCPcopy Create free account
hub / github.com/github/gh-aw / readWorkflowFile

Function readWorkflowFile

pkg/cli/workflows.go:42–59  ·  view source on GitHub ↗

readWorkflowFile reads a workflow file from either filesystem

(filePath string, workflowsDir string)

Source from the content-addressed store, hash-verified

40
41// readWorkflowFile reads a workflow file from either filesystem
42func readWorkflowFile(filePath string, workflowsDir string) ([]byte, string, error) {
43 // Using local filesystem
44 var fullPath string
45
46 // Check if filePath is already an absolute path
47 if filepath.IsAbs(filePath) {
48 fullPath = filePath
49 } else {
50 // Join relative path with workflowsDir
51 fullPath = filepath.Join(workflowsDir, filePath)
52 }
53
54 content, err := os.ReadFile(fullPath)
55 if err != nil {
56 return nil, "", fmt.Errorf("failed to read workflow file %s: %w", fullPath, err)
57 }
58 return content, fullPath, nil
59}
60
61// GitHubWorkflow represents a workflow from GitHub API
62type GitHubWorkflow struct {

Calls 1

ErrorfMethod · 0.45