Skip to content

feat(cli): watch repo-maintenance workflow after enable/disable repos#1615

Open
ralphbean wants to merge 1 commit into
mainfrom
feat/await-repo-maintenance
Open

feat(cli): watch repo-maintenance workflow after enable/disable repos#1615
ralphbean wants to merge 1 commit into
mainfrom
feat/await-repo-maintenance

Conversation

@ralphbean
Copy link
Copy Markdown
Contributor

@ralphbean ralphbean commented May 27, 2026

Summary

  • After fullsend admin enable/disable repos updates config.yaml, the CLI now watches the repo-maintenance workflow run to completion and prints PR URLs from its ::notice:: annotations
  • Adds GetWorkflowRunAnnotations to the forge interface (harvests check-run annotations via GitHub API)
  • Simplifies e2e test polling loops — since the CLI waits for the workflow, the test no longer needs to poll for 2 minutes

Depends on #1612 (fix/e2e-lock-debug) — base branch set accordingly.

Test plan

  • Unit tests for awaitRepoMaintenance (success, timeout, failure, context cancellation)
  • Existing enable/disable unit tests pass (dispatch error injected to skip await)
  • make go-test and make lint pass
  • E2E test validates the full flow end-to-end

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

Site preview

Preview: https://bb6c094c-site.fullsend-ai.workers.dev

Commit: 0362cc13a147acaf3ba962aa9f1bb0d4b00c614a

@fullsend-ai-review
Copy link
Copy Markdown

fullsend-ai-review Bot commented May 27, 2026

Review

Findings

Low

  • [style] internal/cli/admin.go:2481 — Duplicate godoc comment for saveRepoConfig. The old single-line comment (// saveRepoConfig marshals and commits the updated config, then triggers the repo-maintenance workflow.) is retained alongside the new three-line comment. The resulting godoc block has the function name appearing twice.
    Remediation: Delete the old comment line so only the new multi-line comment remains.

  • [correctness] internal/forge/github/github.go:1750GetWorkflowRunAnnotations does not paginate the jobs endpoint (/actions/runs/{id}/jobs) or the annotations endpoint (/check-runs/{id}/annotations). GitHub defaults to 30 items per page for jobs. For typical repo-maintenance runs this is unlikely to matter, but could silently drop data for workflows with many jobs. Consider adding ?per_page=100 to the jobs request.
    Remediation: Append ?per_page=100 to the jobs list URL. Document if pagination is intentionally omitted.

  • [docs-currency] docs/guides/admin/installation.md:232 — The enable command description says "Triggers the repo-maintenance workflow to create enrollment PRs" but the CLI now also watches the workflow to completion and prints PR URLs from annotations. The same applies to the disable command description at line 263. Update both to reflect the new watching behavior.
    Remediation: Update bullet points to mention that the CLI watches the workflow run and reports enrollment/unenrollment PR URLs on completion.

Previous run

Review

Findings

Low

  • [style] internal/cli/admin.go:2393 — Duplicate godoc comment for saveRepoConfig. The old single-line comment (// saveRepoConfig marshals and commits the updated config, then triggers the repo-maintenance workflow.) was retained as a context line, and the new multi-line comment was added below it. The resulting godoc block has the function name appearing twice, which is non-standard. Remove the old comment line.
    Remediation: Delete line 2393 (the old comment) so only the new three-line comment remains.

  • [correctness] internal/forge/github/github.go:1751GetWorkflowRunAnnotations does not paginate either the jobs endpoint (/actions/runs/{id}/jobs) or the annotations endpoint (/check-runs/{id}/annotations). GitHub defaults to 30 items per page for jobs and 100 for annotations. For typical repo-maintenance runs this is unlikely to be an issue, but could silently drop data for workflows with many jobs. Consider adding ?per_page=100 to the jobs request at minimum, or documenting the pagination limitation.

Comment thread internal/cli/admin.go
@@ -2384,34 +2393,111 @@ func loadRepoConfig(ctx context.Context, client forge.Client, printer *ui.Printe
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] style

Duplicate godoc comment for saveRepoConfig. The old single-line comment was retained and the new multi-line comment was added below it, resulting in the function name appearing twice in the comment block.

Suggested fix: Delete the old comment line ("// saveRepoConfig marshals and commits the updated config, then triggers the repo-maintenance workflow.") so only the new three-line comment remains.

// GitHub workflow commands (::notice::, ::warning::) produce check-run
// annotations that are accessible via the check-runs API.
func (c *LiveClient) GetWorkflowRunAnnotations(ctx context.Context, owner, repo string, runID int) ([]forge.Annotation, error) {
// List jobs for this run.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] correctness

GetWorkflowRunAnnotations does not paginate either the jobs endpoint or the annotations endpoint. GitHub defaults to 30 items per page for jobs and 100 for annotations. For typical repo-maintenance runs this is unlikely to be an issue, but could silently drop data for workflows with many jobs.

Suggested fix: Add ?per_page=100 to the jobs request, or document the pagination limitation in the method comment.

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label May 27, 2026
@ralphbean ralphbean changed the base branch from fix/e2e-lock-debug to main May 27, 2026 19:20
After `fullsend admin enable/disable repos` updates config.yaml and
dispatches the repo-maintenance workflow, the CLI now polls for the
workflow run to complete and harvests ::notice:: annotations to display
PR URLs (enrollment or removal PRs) directly in the terminal output.

This replaces the static "The repo-maintenance workflow will create
enrollment PRs" message with live feedback showing the workflow status
and the resulting PR links.

Changes:
- Add Annotation type and GetWorkflowRunAnnotations to forge.Client
- Implement annotation harvesting via GitHub check-runs API
- Add awaitRepoMaintenance helper called by both enable and disable
- saveRepoConfig now returns dispatch time for workflow watching
- Simplify e2e test polling loops since the CLI now waits for the
  workflow to complete before returning

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ralph Bean <rbean@redhat.com>
return buf.String(), nil
}

// GetWorkflowRunAnnotations returns annotations from all jobs in a workflow run.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] correctness

GetWorkflowRunAnnotations does not paginate the jobs endpoint or the annotations endpoint. GitHub defaults to 30 items per page for jobs. Could silently drop data for workflows with many jobs.

Suggested fix: Append ?per_page=100 to the jobs list URL, or document that pagination is intentionally omitted.

@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge and removed ready-for-merge All reviewers approved — ready to merge labels May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge All reviewers approved — ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant