Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class CircleCI plugin support to the gh-devlake GitHub CLI extension, enabling users to create/test CircleCI connections and pick CircleCI projects as scopes via the DevLake remote-scope API.
Changes:
- Added CircleCI to the connection registry (default endpoint, token env keys, supports test, scope handler, scope ID field).
- Implemented a CircleCI remote-scope picker and scope upsert flow (PUT scopes + blueprint scopes).
- Introduced CircleCI scope type plus unit tests; updated docs to include CircleCI usage.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
internal/devlake/types.go |
Adds CircleCIProjectScope type for PUT /scopes payloads. |
cmd/connection_types.go |
Registers CircleCI plugin metadata and wires in the scope handler. |
cmd/configure_scopes.go |
Implements CircleCI remote-scope listing, selection, and scope upsert. |
cmd/connection_types_test.go |
Adds registry coverage for CircleCI and token-expiry matrix update. |
cmd/configure_scopes_test.go |
Adds tests for CircleCI project parsing and label formatting helpers. |
docs/configure-connection.md |
Documents CircleCI connection creation/token requirements and plugin list. |
docs/configure-scope.md |
Documents CircleCI scope selection and expands supported plugin list. |
docs/configure-scope.md
Outdated
| | `--plugin` | *(interactive or required)* | Plugin to configure (`github`, `gh-copilot`, `gitlab`, `bitbucket`, `azuredevops_go`, `jenkins`, `jira`, `sonarqube`, `circleci`) | | ||
| | `--connection-id` | *(auto-detected)* | Override the connection ID to scope | | ||
| | `--org` | *(required)* | GitHub organization slug | | ||
| | `--enterprise` | | Enterprise slug (enables enterprise-level Copilot metrics) | |
There was a problem hiding this comment.
The flags table marks --org as "(required)", but scope add only requires an org for plugins whose ConnectionDef has NeedsOrg set (e.g., CircleCI/Jenkins/SonarQube don’t require it). This is especially confusing now that circleci is listed as a supported plugin. Update the description to indicate --org is plugin-dependent (or list which plugins require it).
cmd/configure_scopes.go
Outdated
| projectMap := make(map[string]devlake.CircleCIProjectScope) | ||
| for _, child := range children { | ||
| if child.Type != "scope" || child.ID == "" { | ||
| continue | ||
| } | ||
| project := circleCIProjectFromChild(child, connID) | ||
| label := circleCIProjectLabel(project) |
There was a problem hiding this comment.
projectMap is keyed by the human-readable label, which can collide (e.g., multiple projects with the same name, or name-only labels when slug is missing). Collisions will overwrite entries in the map and can cause the wrong project to be scoped when a user selects an option. Use a stable unique key (e.g., project ID/slug) for the selection mapping, or make the displayed labels unique by appending the ID when duplicates are detected.
| projectMap := make(map[string]devlake.CircleCIProjectScope) | |
| for _, child := range children { | |
| if child.Type != "scope" || child.ID == "" { | |
| continue | |
| } | |
| project := circleCIProjectFromChild(child, connID) | |
| label := circleCIProjectLabel(project) | |
| projectMap := make(map[string]devlake.CircleCIProjectScope) | |
| // First pass: count how many times each base label appears | |
| labelCounts := make(map[string]int, len(children)) | |
| for _, child := range children { | |
| if child.Type != "scope" || child.ID == "" { | |
| continue | |
| } | |
| project := circleCIProjectFromChild(child, connID) | |
| label := circleCIProjectLabel(project) | |
| labelCounts[label]++ | |
| } | |
| // Second pass: build unique labels and project map | |
| for _, child := range children { | |
| if child.Type != "scope" || child.ID == "" { | |
| continue | |
| } | |
| project := circleCIProjectFromChild(child, connID) | |
| baseLabel := circleCIProjectLabel(project) | |
| label := baseLabel | |
| if labelCounts[baseLabel] > 1 { | |
| // Disambiguate duplicate labels by appending the project ID | |
| label = fmt.Sprintf("%s (ID: %s)", baseLabel, project.ID) | |
| } |
|
@codex[agent] Please address the review findings on this PR: 1) update docs/configure-scope.md so --org is described as plugin-dependent rather than universally required; 2) make CircleCI selection mapping collision-safe so duplicate human-readable labels cannot overwrite the wrong project. After updating, rerun build/test/vet and let the review agent re-check. |
Updated: |
|
@codex[agent] One review item still appears unresolved on this PR: update the configure-scope docs so |
Updated configure-scope docs to state |
|
@codex[agent] This PR now needs a latest-main refresh before merge. Please rebase/update onto current main, preserve the CircleCI fixes, ensure the |
Rebased onto latest main, resolved conflicts (including org docs and CircleCI scopes), restored upstream types, and reran go build/test/vet. Head commit ce3001e. |
|
@codex[agent] thanks — CI is green, but this PR is still |
No description provided.