feat(action): new command group for Gitea Actions workflows #380

Closed
Taoyouce wants to merge 0 commits from Taoyouce/gitlink-cli:feat/actions-group into master
Contributor

What

GitLink ships a full Actions API (Api::V1::Projects::Actions) driving the DevOps tab, but the CLI had no way to touch it. This adds an action command group:

gitlink-cli action +list                      # workflow files under .gitea/workflows
gitlink-cli action +runs -w ci.yml            # paginated run history
gitlink-cli action +run -w ci.yml -r master   # trigger a run
gitlink-cli action +rerun -i 6                # rerun a whole run
gitlink-cli action +job-rerun -i 6 -j build   # rerun one job
gitlink-cli action +disable -w ci.yml         # per-workflow toggle
gitlink-cli action +enable -w ci.yml

Contract notes from the server source:

  • +runs requires workflow (the controller only lists runs when the workflow file exists) — enforced client-side as a required flag.
  • +enable/+disable are per-workflow: the server rejects requests without workflow ("请输入正确的流水线文件!"), so the flag is required. Both forward it as a query param, matching the controller.
  • --run-id is integer-validated before any API call.

Validation

  • Production-verified on gitlink.org.cn: +list (1 workflow), +runs (history returned), +run (a new run appeared in the history), and a +disable+enable round-trip (status: 0).
  • Rerun endpoints surface the server message verbatim when gitea-hat rejects a rerun (e.g. run not in a rerunnable state).
  • 6 unit tests covering paths, query shape, and required-flag/integer guards; go test ./..., go vet, gofmt all clean.
  • README section and bilingual i18n keys (12 pairs) included.
## What GitLink ships a full Actions API (`Api::V1::Projects::Actions`) driving the DevOps tab, but the CLI had no way to touch it. This adds an `action` command group: ```bash gitlink-cli action +list # workflow files under .gitea/workflows gitlink-cli action +runs -w ci.yml # paginated run history gitlink-cli action +run -w ci.yml -r master # trigger a run gitlink-cli action +rerun -i 6 # rerun a whole run gitlink-cli action +job-rerun -i 6 -j build # rerun one job gitlink-cli action +disable -w ci.yml # per-workflow toggle gitlink-cli action +enable -w ci.yml ``` Contract notes from the server source: - `+runs` requires `workflow` (the controller only lists runs when the workflow file exists) — enforced client-side as a required flag. - `+enable`/`+disable` are **per-workflow**: the server rejects requests without `workflow` ("请输入正确的流水线文件!"), so the flag is required. Both forward it as a query param, matching the controller. - `--run-id` is integer-validated before any API call. ## Validation - Production-verified on gitlink.org.cn: `+list` (1 workflow), `+runs` (history returned), `+run` (a new run appeared in the history), and a `+disable` → `+enable` round-trip (`status: 0`). - Rerun endpoints surface the server message verbatim when gitea-hat rejects a rerun (e.g. run not in a rerunnable state). - 6 unit tests covering paths, query shape, and required-flag/integer guards; `go test ./...`, `go vet`, `gofmt` all clean. - README section and bilingual i18n keys (12 pairs) included.
Taoyouce added 5 commits 2026-07-08 22:18:55 +08:00
3c04513b4a feat(action): new command group for Gitea Actions workflows
Wraps the v1 actions API (Api::V1::Projects::Actions):

- action +list: workflow files under .gitea/workflows
- action +runs -w <file>: paginated run history of a workflow
- action +run -w <file> -r <ref>: trigger a run
- action +rerun / +job-rerun: rerun a whole run or a single job
- action +enable / +disable -w <file>: per-workflow toggle (the server
  requires the workflow param; omitting it errors)

Production-verified: list, runs, trigger (new run appeared in history),
and disable/enable round-trip. Rerun endpoints surface the server
message verbatim when gitea-hat rejects the rerun. 6 unit tests,
README section, and bilingual i18n keys.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
05a1859c63 test: include action group in RegisterAll expectations
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Taoyouce added 1 commit 2026-07-08 22:48:06 +08:00
a31c53484e feat(action): add +logs for raw workflow job logs
Wraps GET /actions/runs/:run_id/jobs/:job/logs (runs#job_logs, which
redirects to the log file). Non-JSON body is printed as-is so the
output pipes cleanly into grep/less.

Production-verified on gitlink.org.cn (real run's job log streamed).
Unit test covers the nested path and the --run-id integer guard.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
wbtiger closed this pull request 2026-07-14 22:56:16 +08:00
wbtiger reopened this pull request 2026-07-14 23:01:54 +08:00
wbtiger closed this pull request 2026-07-14 23:04:44 +08:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Gitlink/gitlink-cli#380
No description provided.