hive-forge: add ci-log verb for actions job step logs (closes #1674)
This commit is contained in:
parent
1d259e84f2
commit
2223af1b21
5 changed files with 216 additions and 0 deletions
|
|
@ -283,6 +283,28 @@ impl Client {
|
|||
format!("{}{path}", self.base)
|
||||
}
|
||||
|
||||
/// POST a JSON body to a base-relative *web* path (NOT under
|
||||
/// `/api/v1/`) and decode the JSON response. Used for endpoints
|
||||
/// Forgejo only serves through its web router — e.g. the Actions
|
||||
/// run-view log streamer at
|
||||
/// `<base>/<owner>/<repo>/actions/runs/<run>/jobs/<job>`. The
|
||||
/// agent's `Authorization: token` header is sent as usual; the
|
||||
/// web router accepts a token-authed doer and, because the handler
|
||||
/// consumes a JSON body rather than a CSRF-bound HTML form, no
|
||||
/// `_csrf` token is required (same auth path `get_bytes_raw` uses
|
||||
/// for the web artifact-download route). `path` should start `/`.
|
||||
pub fn post_json_web<B: Serialize>(&self, path: &str, body: &B) -> Result<Value> {
|
||||
let url = self.web_url(path);
|
||||
let resp = self
|
||||
.http
|
||||
.post(&url)
|
||||
.header(CONTENT_TYPE, "application/json")
|
||||
.json(body)
|
||||
.send()
|
||||
.context("POST")?;
|
||||
decode_json(resp, &format!("POST {url}"))
|
||||
}
|
||||
|
||||
/// GET a raw (non-API) URL and return the response body as bytes.
|
||||
/// The client's auth headers are still sent — Forgejo requires them
|
||||
/// for private attachment downloads. Uses the full URL as-is; the
|
||||
|
|
|
|||
Loading…
Reference in a new issue