composio-github

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub via Composio

通过Composio使用GitHub

DO NOT use
gh
CLI - it will fail with "gh auth login" error. Use the Composio HTTP API (curl commands) below instead.
请勿使用
gh
CLI工具——它会出现"gh auth login"认证错误。 请使用下方的Composio HTTP API(curl命令)替代。

Environment

环境配置

bash
COMPOSIO_API_KEY      # API key
COMPOSIO_USER_ID      # Entity ID (required for all requests)
COMPOSIO_CONNECTIONS  # JSON with .github connection ID
bash
COMPOSIO_API_KEY      # API密钥
COMPOSIO_USER_ID      # 实体ID(所有请求均需提供)
COMPOSIO_CONNECTIONS  # 包含.github连接ID的JSON数据

Core Pattern

核心调用模式

bash
CONNECTION_ID=$(echo $COMPOSIO_CONNECTIONS | jq -r '.github')

curl -s "https://backend.composio.dev/api/v3/tools/execute/ACTION_NAME" \
  -H "x-api-key: $COMPOSIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "connected_account_id": "'$CONNECTION_ID'",
    "entity_id": "'$COMPOSIO_USER_ID'",
    "arguments": {}
  }' | jq '.data'
bash
CONNECTION_ID=$(echo $COMPOSIO_CONNECTIONS | jq -r '.github')

curl -s "https://backend.composio.dev/api/v3/tools/execute/ACTION_NAME" \
  -H "x-api-key: $COMPOSIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "connected_account_id": "'$CONNECTION_ID'",
    "entity_id": "'$COMPOSIO_USER_ID'",
    "arguments": {}
  }' | jq '.data'

Quick Start

快速开始

bash
undefined
bash
undefined

List your repositories (public + private)

列出你的所有仓库(公开+私有)

curl -s "https://backend.composio.dev/api/v3/tools/execute/GITHUB_LIST_REPOSITORIES_FOR_THE_AUTHENTICATED_USER"
-H "x-api-key: $COMPOSIO_API_KEY" -H "Content-Type: application/json"
-d '{ "connected_account_id": "'$CONNECTION_ID'", "entity_id": "'$COMPOSIO_USER_ID'", "arguments": {"visibility": "all", "affiliation": "owner,collaborator,organization_member"} }' | jq '.data.repositories'
curl -s "https://backend.composio.dev/api/v3/tools/execute/GITHUB_LIST_REPOSITORIES_FOR_THE_AUTHENTICATED_USER"
-H "x-api-key: $COMPOSIO_API_KEY" -H "Content-Type: application/json"
-d '{ "connected_account_id": "'$CONNECTION_ID'", "entity_id": "'$COMPOSIO_USER_ID'", "arguments": {"visibility": "all", "affiliation": "owner,collaborator,organization_member"} }' | jq '.data.repositories'

List repository issues

列出仓库issues

curl -s "https://backend.composio.dev/api/v3/tools/execute/GITHUB_LIST_REPOSITORY_ISSUES"
-H "x-api-key: $COMPOSIO_API_KEY" -H "Content-Type: application/json"
-d '{ "connected_account_id": "'$CONNECTION_ID'", "entity_id": "'$COMPOSIO_USER_ID'", "arguments": {"owner": "OWNER", "repo": "REPO", "state": "open"} }' | jq
undefined
curl -s "https://backend.composio.dev/api/v3/tools/execute/GITHUB_LIST_REPOSITORY_ISSUES"
-H "x-api-key: $COMPOSIO_API_KEY" -H "Content-Type: application/json"
-d '{ "connected_account_id": "'$CONNECTION_ID'", "entity_id": "'$COMPOSIO_USER_ID'", "arguments": {"owner": "OWNER", "repo": "REPO", "state": "open"} }' | jq
undefined

All Actions

所有可用操作

See references/actions.md for complete API reference including:
  • Repository contents: get files, README, download ZIP
  • Issues: list, create, update, comment
  • Pull requests: list, create, merge
  • Repositories: list, get info
  • Branches: list
查看references/actions.md获取完整的API参考文档,包括:
  • 仓库内容:获取文件、README、下载ZIP包
  • Issues:列出、创建、更新、添加评论
  • Pull Requests:列出、创建、合并
  • 仓库:列出、获取信息
  • 分支:列出

Discover Actions

发现可用操作

bash
curl -s "https://backend.composio.dev/api/v2/actions?apps=github" \
  -H "x-api-key: $COMPOSIO_API_KEY" | jq '.items[] | {name, description}'
bash
curl -s "https://backend.composio.dev/api/v2/actions?apps=github" \
  -H "x-api-key: $COMPOSIO_API_KEY" | jq '.items[] | {name, description}'