Summary
Several cb actions commands currently assume GitHub-style Actions response fields or endpoints. On Codeberg/Forgejo, the Actions API returns different shapes, which can make cb actions runs, cb actions run, and cb actions workflows crash instead of displaying results.
Observed failures
Examples observed against Codeberg repositories with Forgejo Actions enabled:
cb actions runs --repo stackdrift/esphome-components --limit 1- can fail with
AttributeError: 'str' object has no attribute 'get' - root cause: Forgejo returns an object with
workflow_runs, not a raw list
- can fail with
cb actions workflows --repo stackdrift-images/grow-app- can fail with
json.decoder.JSONDecodeError: Extra data - root cause: the current workflow-list endpoint/path is not reliable for Codeberg/Forgejo here, and the client assumes error bodies are JSON
- can fail with
cb actions run <run-id> --repo <owner/repo>- can fail with
KeyError: 'display_title' - expects GitHub-style fields like
display_title,event,head_branch,head_sha, andurl - Forgejo returns fields like
title,trigger_event,prettyref,commit_sha, andhtml_url
- can fail with
Expected behavior
The actions commands should display runs/workflows normally against Codeberg/Forgejo repositories, and repositories without workflows should print a clean "No workflows" message instead of throwing an exception.
Proposed fix
I have a locally tested branch on my fork: !7
- normalizes both Forgejo and legacy/GitHub-style action run fields
- handles Forgejo’s
{"workflow_runs": [...], "total_count": ...}response envelope - updates
cb actions runto display Forgejo run details correctly - lists workflows by reading
.forgejo/workflowsthrough the repository contents API - treats missing workflow directories as "No workflows"
- makes client error parsing tolerate non-JSON error bodies
- adds regression tests for the affected action commands and non-JSON error handling
Verification
I ran the following commands to test behavior with my fix:
uv run cb actions runs --repo stackdrift/esphome-components --limit 3uv run cb actions run 4740659 --repo stackdrift/esphome-componentsuv run cb actions workflows --repo stackdrift-images/grow-appuv run cb actions workflows --repo stackdrift/esphome-componentsuv run cb actions runs --repo stackdrift/starfield-music-tracer --limit 2
I also confirmed the new (and existing) tests passed locally.