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

Function createIssueForUpgradeOrgRepo

pkg/cli/upgrade_org.go:323–357  ·  view source on GitHub ↗

createIssueForUpgradeOrgRepo opens a GitHub issue in the target repository to notify maintainers that agentic workflow upgrades are available. Any previously-open issues carrying the gh-aw-upgrade XML marker are closed first so that only the most recent notification remains.

(ctx context.Context, repo string, verbose bool)

Source from the content-addressed store, hash-verified

321// previously-open issues carrying the gh-aw-upgrade XML marker are closed first
322// so that only the most recent notification remains.
323func createIssueForUpgradeOrgRepo(ctx context.Context, repo string, verbose bool) error {
324 title := "[aw] Upgrade available"
325
326 releaseTag, releaseURL := getGhawReleaseInfo()
327 xmlMarker := buildOrgXMLMarker(ghawUpgradeMarkerPrefix, releaseTag)
328
329 // Close stale upgrade issues before creating the new one.
330 closeExistingOrgIssuesByMarker(ctx, repo, ghawUpgradeMarkerPrefix, verbose)
331
332 var releaseSection string
333 if releaseURL != "" {
334 releaseSection = fmt.Sprintf("\n[View gh-aw release %s](%s)\n", releaseTag, releaseURL)
335 }
336
337 body := "Agentic workflow files detected in this repository may have upgrades available.\n\n" +
338 "Run `gh aw upgrade` to apply the latest codemods, update GitHub Actions versions, and recompile all workflows.\n\n" +
339 "Review the upgrade output and any generated changes before committing to ensure there are no unexpected modifications.\n" +
340 releaseSection + "\n" +
341 "### How to execute\n\n" +
342 "- **Assign to agent**: Assign this issue to Copilot to automatically apply the upgrade\n" +
343 "- **Via @copilot comment**: Add a comment `@copilot upgrade agentic workflows` on this issue\n" +
344 "- **Via CLI**: Run `gh aw upgrade` in your local checkout\n\n" +
345 xmlMarker + "\n"
346
347 if verbose {
348 fmt.Fprintln(os.Stderr, console.FormatVerboseMessage("Creating upgrade issue in "+repo+"..."))
349 }
350
351 if err := createOrgIssue(ctx, repo, title, body, agenticWorkflowsLabel); err != nil {
352 return fmt.Errorf("failed to create issue in %s: %w", repo, err)
353 }
354
355 fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Created issue in "+repo))
356 return nil
357}

Callers

nothing calls this directly

Calls 7

FormatVerboseMessageFunction · 0.92
FormatSuccessMessageFunction · 0.92
getGhawReleaseInfoFunction · 0.85
buildOrgXMLMarkerFunction · 0.85
createOrgIssueFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected