addLabelToOrgPR adds a label to a PR identified by URL using gh pr edit. Errors are non-fatal and emitted as warnings.
(ctx context.Context, prURL, label string, verbose bool)
| 197 | // addLabelToOrgPR adds a label to a PR identified by URL using gh pr edit. |
| 198 | // Errors are non-fatal and emitted as warnings. |
| 199 | func addLabelToOrgPR(ctx context.Context, prURL, label string, verbose bool) { |
| 200 | remoteHost := getHostFromOriginRemote() |
| 201 | if _, err := workflow.RunGHContextWithHost(ctx, "Adding label to PR...", remoteHost, "pr", "edit", prURL, "--add-label", label); err != nil { |
| 202 | orgIPLog.Printf("Failed to add label %q to PR %s: %v", label, prURL, err) |
| 203 | if verbose { |
| 204 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage( |
| 205 | fmt.Sprintf("Failed to add label %q to PR (non-fatal): %v", label, err), |
| 206 | )) |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | // createOrgIssue creates a GitHub issue with the given title, body, and label. If |
| 212 | // creating with the label fails (e.g. label does not exist), it retries once without |
no test coverage detected