Functions

add-labels

fn (owner: Str, repo: Str, number: Int, labels: Vec): Vec
fn (owner: Str, repo: Str, number: Int, labels: Vec, opts: Map): Vec

POST /repos/{owner}/{repo}/issues/{number}/labels - Add labels to an issue.

Example

labels ::github::issues/add-labels("acme", "api", 42, ["bug", "ci"])
map(labels, %.name)

close-issue

fn (owner: Str, repo: Str, number: Int): Map
fn (owner: Str, repo: Str, number: Int, opts: Map): Map

Close an issue (state: "closed", reason "completed").

Example

::github::issues/close-issue("acme", "api", 42)

create-comment

fn (owner: Str, repo: Str, number: Int, body: Str): Map
fn (owner: Str, repo: Str, number: Int, body: Str, opts: Map): Map

POST /repos/{owner}/{repo}/issues/{number}/comments - Comment on an issue or pull request.

Example

comment ::github::issues/create-comment("acme", "api", 42, "Fixed in #68.")
comment.html_url

create-issue

fn (owner: Str, repo: Str, title: Str): Map
fn (owner: Str, repo: Str, title: Str, options: Map): Map
fn (owner: Str, repo: Str, title: Str, options: Map, opts: Map): Map

POST /repos/{owner}/{repo}/issues - Open an issue. options: body, labels (Vec), assignees (Vec), milestone.

Example

issue ::github::issues/create-issue("acme", "api", "Timeout on /v1/users", {
  body: "Repro steps ...",
  labels: ["bug"]
})
issue.number

get-issue

fn (owner: Str, repo: Str, number: Int): Map
fn (owner: Str, repo: Str, number: Int, opts: Map): Map

GET /repos/{owner}/{repo}/issues/{number} - One issue.

Example

issue ::github::issues/get-issue("acme", "api", 42)
issue.state

list-comments

fn (owner: Str, repo: Str, number: Int): Vec
fn (owner: Str, repo: Str, number: Int, params: Map): Vec
fn (owner: Str, repo: Str, number: Int, params: Map, opts: Map): Vec

GET /repos/{owner}/{repo}/issues/{number}/comments - The comments on an issue or pull request. params supports since, per_page, page. Returns a single page (GitHub default 30, max 100); pass page to paginate.

Example

comments ::github::issues/list-comments("acme", "api", 42, {per_page: 100})
map(comments, %.body)

list-issues

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

GET /repos/{owner}/{repo}/issues - List issues (GitHub includes PRs; filter on the pull_request key if you need issues only). params supports state ("open"/"closed"/"all"), labels (comma-separated), assignee, since, per_page, page. Returns a single page (GitHub default 30, max 100); pass page to paginate.

Example

issues ::github::issues/list-issues("acme", "api", {state: "open", labels: "bug,ci"})
map(issues, %.title)

// For one tenant
other ::github::issues/list-issues("acme", "api", {}, {token: ::hot::ctx/get("acme.github-token")})
length(other)

update-issue

fn (owner: Str, repo: Str, number: Int, changes: Map): Map
fn (owner: Str, repo: Str, number: Int, changes: Map, opts: Map): Map

PATCH /repos/{owner}/{repo}/issues/{number} - Update fields: title, body, state ("open"/"closed"), state_reason, labels, assignees.

Example

::github::issues/update-issue("acme", "api", 42, {labels: ["bug", "triaged"]})