GhEx.Deployments (gh_ex v0.3.4)

Copy Markdown View Source

Convenience functions for the GitHub Deployments REST API.

Thin wrappers over GhEx.REST that return the same {:ok, body, meta} / {:error, reason} shape; opts pass through to Req.

A deployment represents a request to deploy a ref, not its changing lifecycle state. Progress is recorded as a sequence of deployment statuses. Automation waiting for completion should inspect the latest item from list_statuses/5 (or consume stream_statuses/5) rather than repeatedly fetching the deployment.

Summary

Functions

Creates a deployment for a ref.

Gets a deployment by id. Read its statuses to observe lifecycle progress.

Lists deployments in a repository. Use params: to filter by ref, SHA, task, or environment.

Lists the status history for a deployment.

Auto-paginates a repository's deployments into a lazy Stream.

Auto-paginates a deployment's status history into a lazy Stream.

Types

id()

@type id() :: integer() | String.t()

Functions

create(client, owner, repo, attrs, opts \\ [])

@spec create(GhEx.Client.t(), String.t(), String.t(), map(), keyword()) ::
  GhEx.REST.result()

Creates a deployment for a ref.

attrs must contain ref; it may also include task, auto_merge, required_contexts, payload, environment, and environment metadata.

create_status(client, owner, repo, deployment_id, attrs, opts \\ [])

@spec create_status(GhEx.Client.t(), String.t(), String.t(), id(), map(), keyword()) ::
  GhEx.REST.result()

Appends a status to a deployment.

attrs must contain state; supported states include error, failure, inactive, in_progress, queued, pending, and success.

get(client, owner, repo, deployment_id, opts \\ [])

@spec get(GhEx.Client.t(), String.t(), String.t(), id(), keyword()) ::
  GhEx.REST.result()

Gets a deployment by id. Read its statuses to observe lifecycle progress.

list(client, owner, repo, opts \\ [])

Lists deployments in a repository. Use params: to filter by ref, SHA, task, or environment.

list_statuses(client, owner, repo, deployment_id, opts \\ [])

@spec list_statuses(GhEx.Client.t(), String.t(), String.t(), id(), keyword()) ::
  GhEx.REST.result()

Lists the status history for a deployment.

Deployment progress is represented by these status records; inspect the latest record when deciding whether a deployment has reached a terminal state.

stream(client, owner, repo, opts \\ [])

@spec stream(GhEx.Client.t(), String.t(), String.t(), keyword()) :: Enumerable.t()

Auto-paginates a repository's deployments into a lazy Stream.

stream_statuses(client, owner, repo, deployment_id, opts \\ [])

@spec stream_statuses(GhEx.Client.t(), String.t(), String.t(), id(), keyword()) ::
  Enumerable.t()

Auto-paginates a deployment's status history into a lazy Stream.