skip to content
$registry / workers

github

v0.4.2-rc.1

GitHub CLI and event-driven PR monitoring — typed queries and mutations, authenticated temporary webhooks, CI/comment/review notifications, and merge-triggered cleanup.

worker
iiiverified
154 installs11 in 7d2 today
install
$iii trigger compose::add worker=github
  • macOS: arm64 · x64
  • Linux: arm64 · armv7 · x64
  • Windows: arm64 · x64

exact versions are immutable; binary and bundle artifacts are digest-pinned.

configuration

iii-config.yaml
- default_timeout_ms: 30000
  gh_executable:
  max_output_bytes: 1048576
  max_timeout_ms: 120000
  webhooks:
    enabled: false
    max_body_bytes: 1048576
    max_pending: 10000
    max_watch_days: 30
    notifications:
      ignore_self: true
      max_comment_chars: 2000
      max_items: 30
      max_wait_ms: 120000
      profile: agent_actionable
      quiet_ms: 15000
    orphan_grace_minutes: 60
    queue: github-webhooks
    storage_path: ./data/github-webhooks/store.sqlite3
    tunnel_id: webhooks
README.md

Monitoramento durável de PR (opt-in)

Além das APIs CLI existentes, github::pr::watch, github::pr::unwatch, github::pr::watch-status, github::pr::recover e o trigger github::pr::event implementam monitoramento por webhooks. O recurso fica desabilitado por padrão; consulte o guia de webhooks para conhecer as permissões, a recuperação e as limitações. Nenhum recurso externo é criado ao registrar a interface com a configuração padrão.

Antes de habilitá-lo, abra GitHub → Webhooks no Console ou chame github::setup::webhooks-status. A lista verifica se o worker opcional quick-tunnel está instalado, se o cloudflared está disponível e se o listener restrito do http foi realmente aberto. O Console só instala quick-tunnel depois da confirmação do operador; ele nunca instala cloudflared e, quando necessário, mostra o guia oficial de instalação. Use github::setup::enable-http-listener e github::setup::enable-webhooks para as alterações guiadas. Ativar os webhooks exige todos os itens confirmados e requer reiniciar o worker github para abrir o armazenamento. github::pr::watch recusa apenas pré-requisitos sabidamente ausentes ou bloqueados; uma verificação temporariamente unknown não gera um falso bloqueio.

github

GitHub as iii functions, powered by the GitHub CLI. Typed github::* functions cover pull requests, issues, repos, Actions runs and workflows, releases, and search; github::exec runs any other gh command and github::api reaches any GitHub REST endpoint. Agents get schema-discoverable GitHub operations with read-vs-mutate permission gating instead of raw shell.

Install

iii trigger compose::add worker=github

iii trigger compose::add resolves the worker and its dependencies, writes exact declarations to worker-compose.yaml, and reconciles the Compose project.

The worker shells out to the GitHub CLI — install a current gh (the typed field sets are validated against gh 2.94) and give it credentials: either gh auth login on the host, or set GH_TOKEN for the worker (see Configuration).

Quickstart

use iii_sdk::{register_worker, InitOptions, TriggerRequest};
use serde_json::json;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let iii = register_worker("ws://localhost:49134", InitOptions::default());

    // Open PRs in a repo, typed and parsed:
    let prs = iii
        .trigger(TriggerRequest {
            function_id: "github::pr::list".into(),
            payload: json!({ "repo": "cli/cli", "state": "open", "limit": 5 }),
            action: None,
            timeout_ms: Some(60_000),
        })
        .await?;
    println!("{prs:#?}"); // { value: [{ number, title, state, url, … }] }

    // Anything else gh can do, verbatim:
    let version = iii
        .trigger(TriggerRequest {
            function_id: "github::exec".into(),
            payload: json!({ "args": ["--version"] }),
            action: None,
            timeout_ms: Some(60_000),
        })
        .await?;
    println!("{version:#?}"); // { stdout, stderr, exit_code, … }

    Ok(())
}

Configuration

gh_executable: ""            # path to gh; empty = `gh` on PATH
token: "${GH_TOKEN}"         # env-expanded; empty = ambient `gh auth login`
default_timeout_ms: 30000    # per-call timeout when timeout_ms is omitted
max_timeout_ms: 120000       # upper clamp for any per-call timeout_ms
max_output_bytes: 1048576    # per-stream capture cap (flags *_truncated)

Other keys (and their defaults) live in src/config.rs.