~evhan/chicken-sourcehut unlisted

CHICKEN client library for the sr.ht REST API
Add build artifact to CI configuration
Fix long option parsing
Ensure CLI result limit is a positive integer

clone

read-only
https://git.sr.ht/~evhan/chicken-sourcehut
read/write
git@git.sr.ht:~evhan/chicken-sourcehut

You can also use your local clone with git send-email.

chicken-sourcehut

CHICKEN Scheme client for sr.ht.

Resources

Installation

Extension Library

Use your distribution's package manager to install CHICKEN 5.0 or newer, then run:

chicken-install -s sourcehut

On some platforms you may be required to install OpenSSL development headers first.

Examples

Using the Extension Library

Create a new job on builds.sr.ht and fetch information about it:

(import (sourcehut)
        (sourcehut builds))

(access-token "your-access-token-goes-here")

(create (job manifest: "xyz"))
; => ((#:service "builds" #:path "/api/jobs")
;     (id . 1234))

(retrieve (job 1234))
; => ((#:service "builds" #:path "/api/jobs/1234")
;     (id . 1234)
;     (status . "running")
;     (setup_log ...)
;     (tasks . #(...))
;     (runner ...))

(retrieve (manifest 1234))
; => "xyz"

Using the Command Line Interface

As above, but using the sourcehut CLI program.

$ export SRHT_ACCESS_TOKEN="your-access-token-goes-here"

$ sourcehut create job --manifest build.yaml --note "Example build"
((id . 1234))

$ sourcehut get job 1234
((id . 1234)
 (status . "running")
 (setup_log ...)
 (tasks . #(...))
 (runner ...))

$ sourcehut get job 1234 -o json | jq
{
  "id": 1234,
  "status": "running",
  "setup_log": ...,
  "tasks": [...],
  "note": "Example build",
  "runner": ...
}

License

Three-clause BSD. See LICENSE for details.