# GitHub Issue 评论 API (github.issue_comments)

- Canonical page: https://everyinfra.com/github-api/issue_comments
- Endpoint: POST /api/v1/social with {"platform": "github", "action": "issue_comments", "params": {...}}
- Price: $0.000958 per call ($0.96 per 1,000 requests); failed and empty results are not charged
- Returns: list, default 30, max 100 per call
- Mode: sync; add "mode": "async" for slow tasks

GitHub Issue 评论按 `url` 读取一条 Issue 或 PR 下的评论，按发布时间从早到晚返回，默认 30 条，单次最多 100 条。每条带全文 `text`、表情回应数 `reaction_count`、作者的 `author_username`、`author_type` 和 `author_association`，以及 `posted_at`。它回答「这条讨论里谁说了什么、谁是维护者」，适合复盘争论、整理排查过程、核对 PR 评审意见。

每行的 `issue_url` 记着它属于哪条 Issue 或 PR，几条讨论存进同一张表时靠它分组。仓库贡献者那一页同样收 `url`，但那里填仓库链接，返回的是人而不是话。

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=github&action=issue_comments

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | GitHub Issue 或 PR 的链接，例如 https://github.com/openai/whisper/pull/1838；按发布时间从早到晚返回评论。 |
| limit | integer (1–100) | no | 30 | 这次调用最多返回的条数，整数，1–100；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | GitHub 内部数字 ID（字符串）。 |
| url | 该记录在原平台上的可访问链接。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| reaction_count | 表情回应总数。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| author_id | 作者在原平台的唯一 ID。 |
| author_avatar_url | 作者头像图片链接（多数平台带签名、会过期）。 |
| author_type | 作者账号类型：User、Bot 或 Organization。 |
| author_association | 作者和仓库的关系，GitHub 原值：OWNER、MEMBER、COLLABORATOR、CONTRIBUTOR、FIRST_TIME_CONTRIBUTOR、NONE 等。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| updated_at | 最近更新时间，ISO 8601 UTC。 |
| issue_url | 请求的 Issue 或 PR 链接（issue_comments）。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "github",
  "action": "issue_comments",
  "params": {
    "url": "https://github.com/openai/whisper/pull/1838"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "github",
        "action": "issue_comments",
        "params": {
            "url": "https://github.com/openai/whisper/pull/1838",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "github",
  "action": "issue_comments",
  "results": [
    {
      "id": …,
      "url": …,
      "text": …,
      "reaction_count": …,
      "author_username": …,
      "author_id": …,
      "author_avatar_url": …,
      "author_type": …,
      "author_association": …,
      "posted_at": …,
      "updated_at": …,
      "issue_url": …,
      "platform": …
    }
  ],
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 怎么找到要读的那条 Issue 或 PR 的链接？

先用 Issue 搜索或仓库的 Issue 与 PR 把条目列出来，结果里每一条都带自己的链接，直接填进 `url`，例如 https://github.com/openai/whisper/pull/1838 这样的 PR 链接。

### 评论是按什么顺序返回的？

按发布时间从早到晚，最早的评论排第一。单次默认 30 条、最多 100 条，用 `limit` 控制取多少；`posted_at` 是 ISO 8601 格式的 UTC 时间，`text` 已去掉 HTML 标签，全文返回、不截断。

### 怎么区分维护者和外部用户的评论？

看 `author_association`，它是 GitHub 的原值：OWNER、MEMBER、COLLABORATOR、CONTRIBUTOR、FIRST_TIME_CONTRIBUTOR、NONE 等。Bot 账号另外看 `author_type`，取值是 User、Bot 或 Organization；`author_username` 通常可用于拼主页链接。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=github
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
