31 lines
1.2 KiB
Markdown
31 lines
1.2 KiB
Markdown
---
|
|
name: gitea-api
|
|
description: Read-only Gitea API queries (list org repos, inspect a repo/PR/issue, check CI runs). Use instead of hand-writing curl with tokens. GET-only and allowlisted, so it never prompts.
|
|
---
|
|
|
|
# Gitea API (read-only)
|
|
|
|
Run for any read query against Gitea instead of constructing `curl` with a token:
|
|
|
|
```bash
|
|
/root/projects/gitea-devtools/gitea-api.sh <path> | jq <filter>
|
|
```
|
|
|
|
Path omits the `api/v1/` prefix and an optional leading `/`. Examples:
|
|
|
|
| Goal | Command |
|
|
|------|---------|
|
|
| List org repos | `gitea-api.sh /orgs/sporel/repos?limit=100 \| jq -r '.[].full_name'` |
|
|
| Inspect a repo | `gitea-api.sh repos/calic/claude-config` |
|
|
| Default branch | `gitea-api.sh repos/sporel/sporel-engine \| jq -r .default_branch` |
|
|
| Open PRs | `gitea-api.sh repos/<owner>/<name>/pulls?state=open` |
|
|
| Recent CI runs | `gitea-api.sh repos/<owner>/<name>/actions/tasks` |
|
|
|
|
It auto-resolves a temp read-scope token via the local `gitea` container (or
|
|
uses `$GITEA_TOKEN`). GET-only — it cannot mutate anything, which is why it's
|
|
safe to run without prompting.
|
|
|
|
On `ERROR: ... HTTP <code>` read the hint line (401 = token/scope, 404 = path).
|
|
If a real query path is missing from this list, just use it — the script
|
|
accepts any GET path.
|