Skip to main content

Crate verctl_github

Crate verctl_github 

Source
Expand description

GitHub REST client for verctl pull requests, Releases, drafts, tags, branch rules, and workflow runs.

Structs§

ActiveRun
A workflow run that has not ended.
AssetFile
A Release asset download_release_assets saved.
ExistingPr
An open pull request.
NewRelease
The Release a run creates for a tag: a draft for release, or a Release published at once for ensure_release.
PullAuthor
Who opened a pull request, and where its head branch lives.
ReleaseList
The Releases of a repository as GET /releases lists them, drafts included, read at most once.
ReleaseRecord
The part of a Release verctl reads, draft or published.
ReleaseState
What GitHub has for one release tag.
Repo
A GitHub repository, as owner/name.

Enums§

DraftState
A tag with no published Release, and the draft a run finds for it.
ExistingRelease
What a run finds on GitHub for one release tag, before it writes anything.
PackageUpload
Whether a release run uploaded a package under a tag.
Stage
Where a Release stands: the stable one, or a candidate before it.

Constants§

TAG_PROOF_DELAYS
How long the tag proof waits before each read after the first, while GitHub answers 404 for a tag that publishing the draft created. Five reads over 15 seconds, inside the 30 seconds the release-tag-order spec allows: GitHub can serve a new tag a moment after the Release that created it, as in rawr run 43414046487.

Functions§

active_run
The first run of the workflow file workflow at commit sha that has not ended, from GET /repos/{owner}/{repo}/actions/workflows/{workflow}/runs with head_sha (list workflow runs). The first 100 runs of that commit are read, and the commit is checked again on each, so a server that ignores the filter finds no run for another commit.
asset_content_type
The HTTP Content-Type header for an uploaded GitHub Release asset name, chosen from its filename suffix.
asset_sha256
The hex SHA-256 that GitHub stores for asset name in the tag Release. It comes from the digest of the asset (sha256:<hex>, see release assets). Reading the digest from GitHub, instead of hashing a local file, keeps the checksum matching the stored asset. A rerun’s build can differ in bytes from the one GitHub kept.
base_branch_with
The branch a Version PR targets: GITHUB_REF_NAME, else VERCTL_DEFAULT_BRANCH, else the branch origin/HEAD names.
branch_rule_types
The type of each rule that applies to branch, from GET /repos/{owner}/{repo}/rules/branches/{branch} (get rules for a branch). The list is empty when no rule applies.
close_pr
Posts comment on pull request number, closes it, and returns its URL.
create_pr
Opens a pull request from head into base.
default_branch_of
repository.default_branch of an event payload, or None when it does not parse or names none.
download_release_assets
Save each of names from the Release of tag, draft or published, into dir under its own name.
ensure_release
Create tag at sha if it is missing. Returns the release HTML URL.
ensure_vendored_release
The Release for a vendored set’s tag, created at sha when the tag has none. Returns its HTML URL.
event_default_branch
The repository’s default branch named by the Actions event payload, or None without an event.
event_is_merge_group
Whether the Actions event is a merge queue’s merge_group event, read from its payload. Without an event it is false.
existing_pr
The open pull request from head in this repository, if one exists.
fetch_oidc_token
Run one future to completion on a fresh current-thread runtime, so the blocking command handlers can call async clients. Request a GitHub Actions OIDC JWT from request_url for audience, using bearer request_token, without exposing the token or URL query string in any error message.
is_merge_group
Whether an event payload is a merge_group event’s.
open_draft
The id of the draft for release: the one found names at HEAD, or a new draft with target_commitish set to release.sha. A stale draft is deleted first.
parse_remote
Parses an ssh or https remote URL on github.com or a *.github.com host.
parse_slug
Parses an owner/name slug.
prove_tag
Prove that tag names head, reading it again after each of delays while GitHub answers 404.
publish_draft
Publish the draft id for release, which creates its tag at release.sha, and return the Release URL.
pull_author
The author of pull request number, from GET /repos/{owner}/{repo}/pulls/{number} (get a pull request).
pull_labels
The labels of pull request number, from GET /repos/{owner}/{repo}/pulls/{number} (get a pull request).
pull_request_is_version_pr
Whether the pull request of this pull_request event is a Version PR by the identity of the version-pr-identity design §1. Its head repository is this repository, and its head branch is verctl/release/<base> for the base it targets now.
pull_request_number
The pull request number of a pull_request event payload, or None when it does not parse or is another event’s.
read_release
Read what GitHub has for tag: the tag and its Release, draft or published, so a run reads what to create before it writes anything.
release_state
Read the tag and the Release for tag, so a plan can tell which parts of a release still need doing. The Release is read even when the tag is missing: a draft has no tag until it is published, so a tagless draft is an incomplete release.
release_url
The HTML URL of the Release id, draft or published, which the report of a run that leaves the draft names.
repo_with
Actions sets GITHUB_REPOSITORY. Locally, origin is the contract.
update_pr
Sets the title and body of pull request number and returns its URL.
upload_release_asset
Attach tarball to the release for tag.
upload_to_release
upload_release_asset to the Release id of tag, which this run opened or found, so the upload never looks the Release up by its tag again: two drafts can share a tag name.
uploaded_assets
The names of the assets of the Release of tag, draft or published, whose upload completed.
write_draft_body
Write body as the notes of draft id of tag, and nothing else, so the draft keeps its state: a failed run records why it stopped there.
write_output
Append to $GITHUB_OUTPUT.