ExecGH wraps gh CLI calls and ensures proper token configuration. It uses go-gh/v2 to execute gh commands when GH_TOKEN or GITHUB_TOKEN is available, otherwise falls back to direct exec.Command for backward compatibility. Usage: cmd := ExecGH("api", "/user") output, err := cmd.Output()
(args ...string)
| 77 | // cmd := ExecGH("api", "/user") |
| 78 | // output, err := cmd.Output() |
| 79 | func ExecGH(args ...string) *exec.Cmd { |
| 80 | //nolint:staticcheck // Passing nil context to use exec.Command instead of exec.CommandContext |
| 81 | return setupGHCommand(nil, args...) |
| 82 | } |
| 83 | |
| 84 | // ExecGHContext wraps gh CLI calls with context support and ensures proper token configuration. |
| 85 | // Similar to ExecGH but accepts a context for cancellation and timeout support. |