Functions

actions-path

fn (owner: Str, repo: Str, suffix: Str): Str

Build a repository Actions API path, including its leading slash.

Example

::github::actions/actions-path("acme", "api", "/runs")  // "/repos/acme/api/actions/runs"

cancel-workflow-run

fn (owner: Str, repo: Str, run-id: Any): Any
fn (owner: Str, repo: Str, run-id: Any, opts: Map): Any

POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel - Cancel a workflow run.

Example

::github::actions/cancel-workflow-run("acme", "api", 1234567890)

disable-workflow

fn (owner: Str, repo: Str, workflow: Any): Any
fn (owner: Str, repo: Str, workflow: Any, opts: Map): Any

PUT /repos/{owner}/{repo}/actions/workflows/{workflow}/disable - Disable a workflow.

Example

::github::actions/disable-workflow("acme", "api", "ci.yml")

dispatch-workflow

fn (owner: Str, repo: Str, workflow: Any, ref: Str): Any
fn (owner: Str, repo: Str, workflow: Any, ref: Str, inputs: Map): Any
fn (owner: Str, repo: Str, workflow: Any, ref: Str, inputs: Map, opts: Map): Any

POST /repos/{owner}/{repo}/actions/workflows/{workflow}/dispatches - Trigger a workflow_dispatch workflow on a ref. workflow is the file name (e.g. "deploy.yml") or numeric id; inputs (5-arity) is the inputs Map. Returns null on success (GitHub replies 204).

Example

::github::actions/dispatch-workflow("acme", "api", "deploy.yml", "main")

// With workflow inputs
::github::actions/dispatch-workflow("acme", "api", "deploy.yml", "main", {environment: "staging"})

download-workflow-attempt-logs

fn (owner: Str, repo: Str, run-id: Any, attempt: Any): Any
fn (owner: Str, repo: Str, run-id: Any, attempt: Any, opts: Map): Any

GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt}/logs

  • Download one attempt's log archive as Bytes.

Example

archive ::github::actions/download-workflow-attempt-logs("acme", "api", 1234567890, 2)
::hot::zip/entries(archive)

download-workflow-job-logs

fn (owner: Str, repo: Str, job-id: Any): Any
fn (owner: Str, repo: Str, job-id: Any, opts: Map): Any

GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs - Download one job's plain-text log. This is the smallest useful log request after list-workflow-jobs identifies a failed checkout or test step.

Example

log ::github::actions/download-workflow-job-logs("acme", "api", 9876543210)
filter(split(log, "\n"), contains(%, "error"))

download-workflow-run-logs

fn (owner: Str, repo: Str, run-id: Any): Any
fn (owner: Str, repo: Str, run-id: Any, opts: Map): Any

GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs - Download a workflow run's log archive as Bytes.

Example

archive ::github::actions/download-workflow-run-logs("acme", "api", 1234567890)
::hot::zip/entries(archive)

enable-workflow

fn (owner: Str, repo: Str, workflow: Any): Any
fn (owner: Str, repo: Str, workflow: Any, opts: Map): Any

PUT /repos/{owner}/{repo}/actions/workflows/{workflow}/enable - Enable a workflow.

Example

::github::actions/enable-workflow("acme", "api", "ci.yml")

get-workflow

fn (owner: Str, repo: Str, workflow: Any): Map
fn (owner: Str, repo: Str, workflow: Any, opts: Map): Map

GET /repos/{owner}/{repo}/actions/workflows/{workflow} - Get a workflow by numeric id or file name.

Example

workflow ::github::actions/get-workflow("acme", "api", "ci.yml")
workflow.state

get-workflow-job

fn (owner: Str, repo: Str, job-id: Any): Map
fn (owner: Str, repo: Str, job-id: Any, opts: Map): Map

GET /repos/{owner}/{repo}/actions/jobs/{job_id} - One workflow job, including its ordered steps and each step's status and conclusion.

Example

job ::github::actions/get-workflow-job("acme", "api", 9876543210)
map(job.steps, %.name)

get-workflow-run

fn (owner: Str, repo: Str, run-id: Any): Map
fn (owner: Str, repo: Str, run-id: Any, opts: Map): Map

GET /repos/{owner}/{repo}/actions/runs/{run_id} - One run's status and conclusion — poll this to watch CI.

Example

run ::github::actions/get-workflow-run("acme", "api", 1234567890)
if(eq(run.status, "completed"), run.conclusion, "still running")

get-workflow-run-attempt

fn (owner: Str, repo: Str, run-id: Any, attempt: Any): Map
fn (owner: Str, repo: Str, run-id: Any, attempt: Any, opts: Map): Map

GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt} - One attempt of a re-run workflow.

Example

attempt ::github::actions/get-workflow-run-attempt("acme", "api", 1234567890, 2)
attempt.conclusion

list-runs-for-workflow

fn (owner: Str, repo: Str, workflow: Any): Map
fn (owner: Str, repo: Str, workflow: Any, params: Map): Map
fn (owner: Str, repo: Str, workflow: Any, params: Map, opts: Map): Map

GET /repos/{owner}/{repo}/actions/workflows/{workflow}/runs - Runs for one workflow. params supports actor, branch, event, status, created, exclude_pull_requests, check_suite_id, head_sha, per_page, and page.

Example

result ::github::actions/list-runs-for-workflow("acme", "api", "ci.yml", {branch: "main", status: "failure"})
map(result.workflow_runs, %.html_url)

list-workflow-attempt-jobs

fn (owner: Str, repo: Str, run-id: Any, attempt: Any): Map
fn (owner: Str, repo: Str, run-id: Any, attempt: Any, params: Map): Map
fn (owner: Str, repo: Str, run-id: Any, attempt: Any, params: Map, opts: Map): Map

GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt}/jobs - Jobs and step conclusions for one workflow attempt. params supports per_page and page.

Example

result ::github::actions/list-workflow-attempt-jobs("acme", "api", 1234567890, 2)
map(result.jobs, %.conclusion)

list-workflow-jobs

fn (owner: Str, repo: Str, run-id: Any): Map
fn (owner: Str, repo: Str, run-id: Any, params: Map): Map
fn (owner: Str, repo: Str, run-id: Any, params: Map, opts: Map): Map

GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs - Jobs and step conclusions for one workflow run. params supports filter ("latest"/"all"), per_page, and page. This is the endpoint that distinguishes a checkout-step failure from a later build or test failure.

Example

result ::github::actions/list-workflow-jobs("acme", "api", 1234567890, {filter: "latest"})
failed filter(result.jobs, eq(%.conclusion, "failure"))
map(failed, %.name)

list-workflow-runs

fn (owner: Str, repo: Str): Map
fn (owner: Str, repo: Str, params: Map): Map
fn (owner: Str, repo: Str, params: Map, opts: Map): Map

GET /repos/{owner}/{repo}/actions/runs - Recent workflow runs. params supports branch, status ("queued"/"in_progress"/"completed"), event, per_page, page. Returns a single page (GitHub default 30, max 100); pass page to paginate.

Example

result ::github::actions/list-workflow-runs("acme", "api", {status: "in_progress", per_page: 20})
map(result.workflow_runs, %.id)

// For one installation or tenant
other ::github::actions/list-workflow-runs("acme", "api", {}, {token: ::hot::ctx/get("acme.github-token")})
other.total_count

list-workflows

fn (owner: Str, repo: Str): Map
fn (owner: Str, repo: Str, params: Map): Map
fn (owner: Str, repo: Str, params: Map, opts: Map): Map

GET /repos/{owner}/{repo}/actions/workflows - Repository workflows. params supports per_page and page.

Example

result ::github::actions/list-workflows("acme", "api", {per_page: 100})
map(result.workflows, %.path)

rerun-failed-workflow-jobs

fn (owner: Str, repo: Str, run-id: Any): Any
fn (owner: Str, repo: Str, run-id: Any, options: Map): Any
fn (owner: Str, repo: Str, run-id: Any, options: Map, opts: Map): Any

POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs - Re-run only failed jobs and their dependent jobs. The optional options Map supports enable_debug_logging.

Example

::github::actions/rerun-failed-workflow-jobs("acme", "api", 1234567890)

rerun-workflow

fn (owner: Str, repo: Str, run-id: Any): Any
fn (owner: Str, repo: Str, run-id: Any, options: Map): Any
fn (owner: Str, repo: Str, run-id: Any, options: Map, opts: Map): Any

POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun - Re-run every job in a workflow run. The optional options Map supports enable_debug_logging.

Example

::github::actions/rerun-workflow("acme", "api", 1234567890)

// With step debug logs
::github::actions/rerun-workflow("acme", "api", 1234567890, {enable_debug_logging: true})

rerun-workflow-job

fn (owner: Str, repo: Str, job-id: Any): Any
fn (owner: Str, repo: Str, job-id: Any, options: Map): Any
fn (owner: Str, repo: Str, job-id: Any, options: Map, opts: Map): Any

POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun - Re-run one job and its dependent jobs. The optional options Map supports enable_debug_logging.

Example

::github::actions/rerun-workflow-job("acme", "api", 9876543210)

with-query

fn (path: Str, params: Map): Str

Append GitHub REST query parameters to an endpoint path.

Example

::github::actions/with-query("/repos/acme/api/actions/runs", {status: "completed"})
// "/repos/acme/api/actions/runs?status=completed"