Glanceway Glanceway
所有信息源

GitHub Notifications

开发者

Get GitHub notifications in your menu bar. Supports filtering by repository.

@codytseng #github #notifications #developer

安装与配置方法

  1. 先在 Mac 上安装并打开 Glanceway,再使用上方的安装链接。
  2. 点击“安装到 Glanceway”。如果浏览器无法唤起应用,下载 .gwsrc 文件并在信息源管理中导入。
  3. 填写下列必填字段并保存,设置刷新间隔,等待首次成功获取。

配置检查

  • GITHUB_TOKEN — 必填. Personal access token from GitHub Settings 填写自己的访问凭据,不要在截图或公开文件中分享。
  • REPOSITORY — 可选. Optional: Filter by repository (format: owner/repo)

使用具有通知访问权限的经典个人访问令牌。GitHub 通知端点不支持细粒度令牌。REPOSITORY 接受单个 owner/repo 值;空列表可能表示没有未读通知。

配置示例

GITHUB_TOKEN: <your GitHub classic token>
REPOSITORY: glanceway/glanceway-sources

没有显示内容时如何排查

  • 对照当前版本配置表核对字段、列表项和凭据。下方示例不包含可用的真实凭据。
  • 检查网络与上游服务状态。认证失败或速率限制可能导致刷新失败,应根据上游限制调整间隔。
  • 空列表也可能表示没有符合条件的条目。内容和更新时间取决于数据提供方及信息源实现。

配置项

名称 键 类型 必填 默认值 描述
GitHub Token GITHUB_TOKEN secret 是 — Personal access token from GitHub Settings
Repository REPOSITORY string 否 — Optional: Filter by repository (format: owner/repo)

源代码

id: codytseng/github-notifications
version: 1.1.0
name: GitHub Notifications
description: |
  Get GitHub notifications in your menu bar.
  Supports filtering by repository.
author: codytseng
author_url: https://github.com/codytseng
category: Developer
tags:
  - github
  - notifications
  - developer

config:
  - key: GITHUB_TOKEN
    name: GitHub Token
    type: secret
    required: true
    description: "Personal access token from GitHub Settings"
  - key: REPOSITORY
    name: Repository
    type: string
    required: false
    description: "Optional: Filter by repository (format: owner/repo)"
module.exports = async (api) => {
  const token = api.config.get("GITHUB_TOKEN");
  const repository = api.config.get("REPOSITORY");

  async function fetchData() {
    const url = repository
      ? `https://api.github.com/repos/${repository}/notifications?per_page=100`
      : "https://api.github.com/notifications?per_page=100";

    const response = await api.fetch(url, {
      headers: { Authorization: `Bearer ${token}` },
    });

    if (!response.ok || !response.json) {
      throw new Error(
        `Failed to fetch GitHub notifications (HTTP ${response.status})`,
      );
    }

    const items = response.json
      .map((item) => {
        const itemUrl = item.subject.url
          ? item.subject.url
              .replace("api.github.com/repos", "github.com")
              .replace("/pulls/", "/pull/")
              .replace("/issues/", "/issues/")
          : null;

        if (!itemUrl) {
          return null;
        }

        return {
          id: item.id,
          title: item.subject.title,
          subtitle: item.repository.full_name,
          url: itemUrl,
          timestamp: item.updated_at,
          notify: true,
        };
      })
      .filter(Boolean);

    api.emit(items);
  }

  await fetchData();

  return {
    refresh: fetchData,
  };
};
id: codytseng/github-notifications
version: 1.0.0
name: GitHub Notifications
description: |
  Get GitHub notifications in your menu bar.
  Supports filtering by repository.
author: codytseng
author_url: https://github.com/codytseng
category: Developer
tags:
  - github
  - notifications
  - developer

config:
  - key: GITHUB_TOKEN
    name: GitHub Token
    type: secret
    required: true
    description: "Personal access token from GitHub Settings"
  - key: REPOSITORY
    name: Repository
    type: string
    required: false
    description: "Optional: Filter by repository (format: owner/repo)"
module.exports = async (api) => {
  const token = api.config.get("GITHUB_TOKEN");
  const repository = api.config.get("REPOSITORY");

  async function fetchData() {
    const url = repository
      ? `https://api.github.com/repos/${repository}/notifications?per_page=100`
      : "https://api.github.com/notifications?per_page=100";

    const response = await api.fetch(url, {
      headers: { Authorization: `Bearer ${token}` },
    });

    if (!response.ok || !response.json) {
      throw new Error(
        `Failed to fetch GitHub notifications (HTTP ${response.status})`,
      );
    }

    const items = response.json
      .map((item) => {
        const itemUrl = item.subject.url
          ? item.subject.url
              .replace("api.github.com/repos", "github.com")
              .replace("/pulls/", "/pull/")
              .replace("/issues/", "/issues/")
          : null;

        if (!itemUrl) {
          return null;
        }

        return {
          id: item.id,
          title: item.subject.title,
          subtitle: item.repository.full_name,
          url: itemUrl,
          timestamp: item.updated_at,
        };
      })
      .filter(Boolean);

    api.emit(items);
  }

  await fetchData();

  return {
    refresh: fetchData,
  };
};

相关信息源