Skip to content
This repository was archived by the owner on Jul 22, 2026. It is now read-only.

feat: add GitCode Actions (CI) API support#18

Open
TommyLike wants to merge 2 commits into
mainfrom
feat/gitcode-actions
Open

feat: add GitCode Actions (CI) API support#18
TommyLike wants to merge 2 commits into
mainfrom
feat/gitcode-actions

Conversation

@TommyLike

Copy link
Copy Markdown
Collaborator

Summary

Add GitCode Actions/CI API support with 19 new endpoints.

Changes

File Change
assets/openapi/gitcode/openapi.json Updated spec with action endpoints
internal/registry/builtin.go TagReassign rule for bare repos/{o}/{r}
internal/view/builtin.go View configs: action/list, action/list-runs, action/list-jobs
internal/builder/build_test.go Apply builtin normalizer in embedded spec tests
scenarios/gitcode/action-artifacts.yaml Smoke test for artifact listing
scenarios/gitcode/action-runs.yaml Smoke test for workflow run listing

New Commands

cora gitcode action list          # list repo artifacts
cora gitcode action list-runs     # list workflow runs
cora gitcode action list-jobs     # list run jobs
cora gitcode action list-artifacts  # list run artifacts
cora gitcode action get           # get artifact detail

Quality

  • go test ./... — all pass
  • go vet ./... — clean
  • gofmt -l . — clean
  • ✅ Action smoke tests pass locally

Generated with Claude Code

- Updated GitCode OpenAPI spec with 19 new action endpoints (artifact,
  run, job, runner-group, runner-set, runner management)
- Added TagReassign rule for bare repos/{o}/{r} to prevent Users tag
  pollution from new spec
- Added view configs for action/list, action/list-runs, action/list-jobs
- Added smoke test scenarios for action artifacts and action runs
- Fixed build_test.go to apply builtin normalizer rules in tests

New commands:
  cora gitcode action list        # list repo artifacts
  cora gitcode action list-runs   # list workflow runs
  cora gitcode action list-jobs   # list run jobs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@opensourceways-bot

Copy link
Copy Markdown

Welcome To opensourceways Community

Hey @TommyLike , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

TommyLike, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown

Linking Issue Notice

@TommyLike , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces built-in views for GitCode action commands (list, list-runs, list-jobs), adds scenario tests for action artifacts and runs, and updates the tag reassignment rules. Feedback on the changes highlights two main issues: first, the broad path prefix rule for repositories may incorrectly hijack and group action-related endpoints under the repositories tag, which can be resolved by adding a more specific rule for actions; second, the test helper duplicates normalization rules from the registry, which should instead be loaded directly via the registry package to avoid maintenance overhead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

},
TagReassign: []spec.TagReassignRule{
{PathPrefix: "/api/v5/repos/{owner}/{repo}/pulls", Tag: "Pulls"},
{PathPrefix: "/api/v5/repos/{owner}/{repo}", Tag: "Repositories"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The newly added bare prefix rule {PathPrefix: "/api/v5/repos/{owner}/{repo}", Tag: "Repositories"} will match any sub-paths under /api/v5/repos/{owner}/{repo} that do not have a more specific rule. This includes the newly added Actions/CI endpoints (e.g., /api/v5/repos/{owner}/{repo}/actions/...), which will be incorrectly reassigned to "Repositories" (and thus grouped under the repos command instead of action).

To prevent this hijacking and ensure the Actions/CI endpoints are correctly grouped under the action command, add an explicit, more specific TagReassign rule for the /actions sub-path.

Suggested change
{PathPrefix: "/api/v5/repos/{owner}/{repo}", Tag: "Repositories"},
{PathPrefix: "/api/v5/repos/{owner}/{repo}/actions", Tag: "Action"},
{PathPrefix: "/api/v5/repos/{owner}/{repo}", Tag: "Repositories"},

Comment thread internal/builder/build_test.go Outdated
Comment on lines +298 to +331
// Apply built-in normalizer rules (same as LoadSpec in registry).
normalizer := builtinNormalizer(svcName)
if normalizer != nil {
s = normalizer.Normalize(s)
}
cfg := &config.Config{Services: map[string]config.ServiceConfig{svcName: {BaseURL: "http://x"}}}
return Build(svcName, s, cfg, executor.New(cfg), view.NewRegistry())
}

// builtinNormalizer returns the built-in normalizer for a service, or nil.
func builtinNormalizer(svcName string) *spec.Normalizer {
switch svcName {
case "gitcode":
return spec.NewNormalizer(spec.NormalizeRule{
ResourceAlias: map[string]string{
"repositories": "repos",
"organizations": "orgs",
"pull-requests": "pulls",
},
TagReassign: []spec.TagReassignRule{
{PathPrefix: "/api/v5/repos/{owner}/{repo}/pulls", Tag: "Pulls"},
{PathPrefix: "/api/v5/repos/{owner}/{repo}", Tag: "Repositories"},
{PathPrefix: "/api/v5/repos/{owner}/{repo}/issues", Tag: "Issues"},
{PathPrefix: "/api/v5/repos/{owner}/{repo}/labels", Tag: "Labels"},
{PathPrefix: "/api/v5/repos/{owner}/{repo}/branches", Tag: "Branch"},
{PathPrefix: "/api/v5/repos/{owner}/{repo}/tags", Tag: "Tag"},
{PathPrefix: "/api/v5/repos/{owner}/{repo}/releases", Tag: "Release"},
{PathPrefix: "/api/v5/repos/{owner}/{repo}/milestones", Tag: "Milestone"},
},
OpIDVerbExtract: true,
})
}
return nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The builtinNormalizer function duplicates the entire gitcodeNormalize rule definition from internal/registry/builtin.go. This introduces a maintenance hazard where any updates to the normalization rules must be manually synchronized across both files.

Instead of duplicating the rules, you can leverage the existing registry package to load and normalize the spec. This ensures that the tests always run against the exact same normalization rules used in production.

Note: You will need to add "github.com/opensourceways/cora/internal/registry" to the import block at the top of this file.

	_ = loader
	_ = data
	cfg := &config.Config{
		Services: map[string]config.ServiceConfig{svcName: {BaseURL: "http://x"}},
	}
	cfg.SpecCache.Dir = t.TempDir()
	reg := registry.New(cfg)
	entry, err := reg.Lookup(svcName)
	if err != nil {
		t.Fatalf("failed to lookup service %s: %v", svcName, err)
	}
	s, err = entry.LoadSpec(context.Background())
	if err != nil {
		t.Fatalf("failed to load %s spec: %v", svcName, err)
	}
	return Build(svcName, s, cfg, executor.New(cfg), view.NewRegistry())
}

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

TommyLike, thanks for your pull request. All authors of the commits have signed the CLA. 👍

- Add /actions TagReassign rule to prevent bare repos rule from
  hijacking actions endpoints
- Replace duplicated normalizer rules in tests with registry.New()
  to ensure parity with production LoadSpec behavior

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@TommyLike
TommyLike force-pushed the feat/gitcode-actions branch from 21d9554 to 1290e27 Compare July 21, 2026 06:06
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

TommyLike, thanks for your pull request. All authors of the commits have signed the CLA. 👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants