Skip to content

gitea.actions.base

base

Base class for the Gitea Actions resource: every path it addresses, in one place.

The Actions endpoints differ from the rest of this API in three ways worth knowing before reading the methods below.

Most listings answer with an object, and some do not. /actions/workflows, /actions/runs, /actions/runs/{run}/jobs, /actions/artifacts and /actions/runners each answer with an object carrying total_count and the array under a key of its own (workflows, workflow_runs, jobs, artifacts, runners). So those listing methods hand back a dictionary where list_labels and its neighbours hand back a list, and their default for a response without a body is the empty object rather than the empty list. The secret and variable listings are the exception: those two answer with a bare array, as the rest of the API does, and so hand back a list and fall back to the empty one. The difference is Gitea's, not this library's, and a caller reading ["secrets"] off a secret listing is reading a key that endpoint never sends.

Two endpoints do not answer with JSON at all. The logs of a job are the log file, and an artifact is the zip archive; get_workflow_job_logs therefore hands back text and download_artifact hands back bytes. Both are the payload itself rather than a parsed body, and neither response has a field naming what it carries - which is why the CLI commands over them add the job or the artifact they asked for.

Most of the API exists at four scopes. Secrets, variables, runners and the run and job listings belong to a repository, to an organization, to the authenticated account or to the instance, and the path differs while the request does not. Which one a call means is decided by the coordinates it was given, and gitea.actions.scope is where that decision and its refusals live; the builders here name the scopes their endpoint offers and let it reject the rest. The workflow endpoints, the run management endpoints and the artifact endpoints have no form but the repository one.

Classes

gitea.actions.base.BaseActions

Base class for the Gitea Actions resource.

Functions: