You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add --org flag to create command for selected_orgs visibility (#21)
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.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jasonrclark <130504+jasonrclark@users.noreply.github.com>
createCmd.Flags().StringVarP(&createCmdFlags.app, "app", "a", "", "The app ID to create")
72
83
createCmd.Flags().StringVarP(&createCmdFlags.name, "name", "n", "", "The name for the app")
73
-
createCmd.Flags().StringVarP(&createCmdFlags.visibility, "visibility", "v", "", "The visibility of the app (e.g. 'only_owner' or 'github')")
84
+
createCmd.Flags().StringVarP(&createCmdFlags.visibility, "visibility", "v", "", "The visibility of the app (e.g. 'only_owner', 'github', or 'selected_orgs')")
85
+
createCmd.Flags().StringVarP(&createCmdFlags.org, "org", "o", "", "The organization login to grant access (only valid with --visibility=selected_orgs)")
74
86
createCmd.Flags().StringSliceVarP(&createCmdFlags.environmentVariables, "env", "e", []string{}, "Environment variables to set on the app in the form 'key=value'")
75
87
createCmd.Flags().StringSliceVarP(&createCmdFlags.secrets, "secret", "s", []string{}, "Secrets to set on the app in the form 'key=value'")
76
88
createCmd.Flags().StringVarP(&createCmdFlags.revisionName, "revision-name", "r", "", "The revision name to use for the app")
0 commit comments