Skip to main content

Module github

Module github 

Source
Expand description

The GitHub REST API as the scheduler and the history need it: queued jobs, a job’s steps, just-in-time runner configs, repository runners, cancelling a run, and the owner’s job actions (ADR 0134). Owns the token (token), which workflow each run is of and what it is named (workflows, ADR 0140), the pages of a listing, conditional requests and the answers kept for them, rate-limit backoff, and the count of what it asks and the limit it last read. It must never put the token in a log line, a Debug output or an error, nor send it anywhere but its base URL, and it decides nothing about scheduling. A job action’s request is read for its status and headers only: its body is never read, and what it returns is a class and a status, never text.

Structs§

Github
A GitHub API client for one token. Requests on one URL are conditional on its last ETag, so an unchanged answer costs no rate limit.
JobDetails
A job as GET /repos/{owner}/{repo}/actions/jobs/{id} describes it: its progress and steps.
JobStep
A step of JobDetails.
NamedRun
A run’s workflow name, learnt after its jobs were read under GitHub’s name for the run.
PullRequest
A pull request, as GET /repos/{owner}/{repo}/pulls/{number} says.
QueuedJob
A job waiting for a runner.
RateLimit
The primary limit’s last reading: GitHub sends it with every answer, 304s included.
Report
What a window counted, and the limit’s last reading.
RepositoryDetails
A repository, as GET /repos/{owner}/{repo} says.
RunNow
A workflow run as a job action needs it: which attempt is current, and whether it completed.
RunTrigger
What started a workflow run, as GET /repos/{owner}/{repo}/actions/runs/{id} says.
Runner
A runner registered on a repository.
Spend
What the scheduler paces GitHub’s reads by: the limit as the last answer gave it, and how many registrations and deletes were sent since the client was made, a count no window’s line starts over.
Tally
How many requests of one class got each kind of answer.
Token
A GitHub token. Its Debug output never shows the value.

Enums§

ActionFailure
Why a job action’s request, or its read of the run, got no success: a class and a status. Holds no text, so nothing GitHub wrote, and no token, can leave through it.
Class
What a request asked for, as the engine’s own work: the requests of one class cost about the same and are made for the same reason.
Deleted
What deleting a runner did.
Error
What a GitHub request can fail with. No variant holds the token.
JobActionRequest
A write the owner asks for through POST /v1/jobs/{id}/cancel and POST /v1/jobs/{id}/rerun (ADR 0134).

Constants§

API_URL
The public API’s address.
TOKEN_DEADLINE
How long gh auth token may take, a keyring’s prompt included, before its process group is killed: under a job action’s deadline, so the action can still say what happened.

Traits§

GithubApi
The GitHub calls the scheduler makes. Github is the real client; the engine’s tests use a fake.

Functions§

gh_token
The gh CLI’s token for github.com (gh auth token), in a process group of its own killed past TOKEN_DEADLINE or once the daemon stops (command::RUNNING).
install_crypto_provider
Makes ring the process’s TLS crypto provider, which every reqwest::Client needs: reqwest is built without one. Calling it again does nothing.

Type Aliases§

Permit
Asked once a job action’s token is in hand and before each send of it, the one after a 401 included: whether it may still go. It may read GitHub itself; nothing is sent while it runs.
TokenSource
Where the client gets a token: at start and again when GitHub answers 401.