Todas as fontes
GitHub Notifications
Desenvolvimento v1.0.0Get GitHub notifications in your menu bar. Supports filtering by repository.
@codytseng #github #notifications #developer
Configuração
| Nome | Chave | Tipo | Obrigatório | Padrão | Descrição |
|---|---|---|---|---|---|
| GitHub Token | GITHUB_TOKEN | secret | Sim | — | Personal access token from GitHub Settings |
| Repository | REPOSITORY | string | Não | — | Optional: Filter by repository (format: owner/repo) |
Código-fonte
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)" 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,
};
}; 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,
};
};