Skip to content

feat: add --org flag to create command for selected_orgs visibility#21

Open
Copilot wants to merge 3 commits intomainfrom
copilot/add-org-argument-to-create-command
Open

feat: add --org flag to create command for selected_orgs visibility#21
Copilot wants to merge 3 commits intomainfrom
copilot/add-org-argument-to-create-command

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 6, 2026

Part of https://github.com/github/spark/issues/817

⚠️ Depends on https://github.com/github/github/pull/426192

Summary

Adds --org argument to the gh runtime create command to support the upcoming GitHub API organization_login parameter.

Changes

  • Added org field to createCmdFlags struct
  • Added OrganizationLogin field (JSON: organization_login) to createReq struct
  • Added --org / -o flag registration with descriptive help text
  • Updated --visibility flag description to include selected_orgs
  • Updated command Example to document the new flag
  • Added validation in runCreate:
    • --org is rejected unless --visibility=selected_orgs
    • --org is required when --visibility=selected_orgs
  • Passes the org value as organization_login in the API request body

Tests

  • TestRunCreate_OrgWithoutSelectedOrgsVisibility – verifies error when --org is used with a non-selected_orgs visibility
  • TestRunCreate_SelectedOrgsVisibilityWithoutOrg – verifies error when --visibility=selected_orgs is used without --org
  • TestRunCreate_WithOrgAndSelectedOrgsVisibility – verifies successful request with correct organization_login in the body

All existing tests continue to pass.

@jasonrclark jasonrclark marked this pull request as ready for review April 7, 2026 19:03
@jasonrclark jasonrclark requested a review from a team as a code owner April 7, 2026 19:03
Copilot AI review requested due to automatic review settings April 7, 2026 19:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for scoping gh runtime create visibility to “selected_orgs” by introducing an --org/-o flag and wiring it through to the API request as organization_login.

Changes:

  • Added --org/-o flag and request payload field organization_login.
  • Added validation rules tying --org to --visibility=selected_orgs.
  • Added/updated unit tests to cover the new validation and request body behavior.
Show a summary per file
File Description
go.mod Promotes stretchr/testify from indirect to direct dependency (used by tests).
cmd/create.go Registers --org/-o, validates flag combinations, and sends organization_login in the create request.
cmd/create_test.go Adds tests for invalid/valid --org + --visibility=selected_orgs combinations and request body assertions.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants