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

Function getLatestWorkflowEditTimeFromCheckout

pkg/cli/update_org.go:236–256  ·  view source on GitHub ↗
(ctx context.Context, checkoutDir, workflowPath string)

Source from the content-addressed store, hash-verified

234}
235
236func getLatestWorkflowEditTimeFromCheckout(ctx context.Context, checkoutDir, workflowPath string) (time.Time, error) {
237 relativePath := workflowPath
238 if filepath.IsAbs(workflowPath) {
239 rel, err := filepath.Rel(checkoutDir, workflowPath)
240 if err != nil {
241 return time.Time{}, fmt.Errorf("failed to derive workflow path relative to checkout %s for %s: %w", checkoutDir, workflowPath, err)
242 }
243 relativePath = rel
244 }
245
246 cmd := exec.CommandContext(ctx, "git", "-C", checkoutDir, "log", "--max-count=1", "--format=%cI", "--", relativePath)
247 output, err := cmd.Output()
248 if err != nil {
249 return time.Time{}, fmt.Errorf("failed to read latest commit time for %s in checkout %s: %w", relativePath, checkoutDir, err)
250 }
251 date := strings.TrimSpace(string(output))
252 if date == "" {
253 return time.Time{}, fmt.Errorf("no commit date available for %s", workflowPath)
254 }
255 return time.Parse(time.RFC3339, date)
256}
257
258func waitForOrgRateLimit(ctx context.Context, resource string, verbose bool) error {
259 output, err := workflow.RunGHContext(ctx, "Checking rate limit...", "api", "rate_limit")

Calls 1

ErrorfMethod · 0.45