Personal Telegram developer console for GitHub

feat: add actionable issue and release drill-downs

davoodmehraban89 committed Oct 4, 2026 at 17:31 UTC 155eb1f4ee00fe103ec66fe1caf770bcccf0e537
2 files changed +51 -2
src/github.js
+14
@@ -433,6 +433,13 @@ export class GitHubService {
433 };
434 }
435
436 + async getIssue(repoRef, issueNumber) {
437 + const number = numericId(issueNumber, 'issue');
438 + const { apiBase } = await this.getRepositoryContext(repoRef);
439 + const issue = await this.requestJson(apiBase + '/issues/' + number, 'GitHub issue');
440 + return { ...this.mapIssue(issue), body: issue.body || '', labels: (issue.labels || []).map(label => typeof label === 'string' ? label : label.name).filter(Boolean), assignees: (issue.assignees || []).map(user => user.login).filter(Boolean), createdAt: issue.created_at || '', updatedAt: issue.updated_at || '' };
441 + }
442 +
443 async listReleases(repoRef, { perPage = 10, page = 1 } = {}) {
444 const count = clampPerPage(perPage, 10); const pageNumber = clampPage(page); const { apiBase } = await this.getRepositoryContext(repoRef);
445 const data = await this.requestJson(`${apiBase}/releases?per_page=${count}&page=${pageNumber}`, 'GitHub releases');
@@ -442,6 +449,13 @@ export class GitHubService {
449 }));
450 }
451
452 + async getRelease(repoRef, releaseId) {
453 + const id = numericId(releaseId, 'release');
454 + const { apiBase } = await this.getRepositoryContext(repoRef);
455 + const release = await this.requestJson(apiBase + '/releases/' + id, 'GitHub release');
456 + return { id: release.id, tag: release.tag_name || '', name: release.name || release.tag_name || 'Release', body: release.body || '', draft: !!release.draft, prerelease: !!release.prerelease, publishedAt: release.published_at || release.created_at || '', author: release.author?.login || 'unknown', target: release.target_commitish || '', url: release.html_url || '' };
457 + }
458 +
459 async rerunFailedWorkflowRun(repoRef, runId) {
460 const id = numericId(runId, 'workflow run'); const { apiBase } = await this.getRepositoryContext(repoRef);
461 return this.requestJson(`${apiBase}/actions/runs/${id}/rerun-failed-jobs`, 'GitHub rerun failed jobs', { method: 'POST', allowEmpty: true });
src/plugins/github/plugin.js
+37 -2
@@ -323,7 +323,22 @@ async function issuesView(github, repoId, page = 1) {
323 : '<i>Issueی یافت نشد.</i>';
324 return {
325 text: `🐛 <b>Issues — ${escapeHtml(repo.name)}</b>\nصفحه: <b>${page}</b>\n➖➖➖➖➖➖➖➖➖➖\n${body}`,
326 - reply_markup: { inline_keyboard: [...explicitPagination('issues', repoId, page, !!issuePage.hasMore), [{ text: '🔙 پروژه', callback_data: `repo:${repoId}` }]] }
326 + reply_markup: { inline_keyboard: [
327 + ...issues.slice(0, 20).map(issue => [{ text: `#${issue.number} ${short(issue.title, 42)}`, callback_data: `issuedetail:${repoId}:${issue.number}` }]),
328 + ...explicitPagination('issues', repoId, page, !!issuePage.hasMore),
329 + [{ text: '🔙 پروژه', callback_data: `repo:${repoId}` }]
330 + ] }
331 + };
332 +}
333 +
334 +async function issueDetailView(github, repoId, issueNumber) {
335 + const [repo, issue] = await Promise.all([github.getRepository(repoId), github.getIssue(repoId, issueNumber)]);
336 + const labels = (issue.labels || []).map(label => `#${escapeHtml(label)}`).join(' ');
337 + const assignees = (issue.assignees || []).map(name => `@${escapeHtml(name)}`).join(' ');
338 + const body = escapeHtml(short(issue.body || '', 1800));
339 + return {
340 + text: `🐛 <b>Issue #${issue.number} — ${escapeHtml(repo.name)}</b>\n<b>${escapeHtml(issue.title)}</b>\n${stateIcon(issue.state)} ${escapeHtml(issue.state || 'unknown')} · ${escapeHtml(issue.author)} · ${issue.comments ?? 0} comments\nLabels: ${labels || '-'}\nAssignees: ${assignees || '-'}\nUpdated: ${escapeHtml(issue.updatedAt || issue.createdAt || '-')}\n➖➖➖➖➖➖➖➖➖➖\n${body || '<i>بدون توضیح.</i>'}`,
341 + reply_markup: { inline_keyboard: [[{ text: '🔄 بروزرسانی', callback_data: `issuedetail:${repoId}:${issueNumber}` }, { text: '🔙 Issues', callback_data: `issues:${repoId}` }]] }
342 };
343 }
344
@@ -334,7 +349,21 @@ async function releasesView(github, repoId, page = 1) {
349 : '<i>هیچ Release منتشرشده‌ای برای این مخزن در GitHub وجود ندارد.</i>';
350 return {
351 text: `🏷 <b>Releases — ${escapeHtml(repo.name)}</b>\nصفحه: <b>${page}</b>\n➖➖➖➖➖➖➖➖➖➖\n${body}`,
337 - reply_markup: { inline_keyboard: [...listPagination('releases', repoId, page, releases.length, 10), [{ text: '🔙 پروژه', callback_data: `repo:${repoId}` }]] }
352 + reply_markup: { inline_keyboard: [
353 + ...releases.slice(0, 10).map(release => [{ text: `🏷 ${short(release.tag || release.name, 42)}`, callback_data: `releasedetail:${repoId}:${release.id}` }]),
354 + ...listPagination('releases', repoId, page, releases.length, 10),
355 + [{ text: '🔙 پروژه', callback_data: `repo:${repoId}` }]
356 + ] }
357 + };
358 +}
359 +
360 +async function releaseDetailView(github, repoId, releaseId) {
361 + const [repo, release] = await Promise.all([github.getRepository(repoId), github.getRelease(repoId, releaseId)]);
362 + const body = escapeHtml(short(release.body || '', 1800));
363 + const flags = [release.draft ? 'draft' : '', release.prerelease ? 'pre-release' : ''].filter(Boolean).join(' · ');
364 + return {
365 + text: `🏷 <b>${escapeHtml(release.name)} — ${escapeHtml(repo.name)}</b>\nTag: <code>${escapeHtml(release.tag || '-')}</code>\nTarget: <code>${escapeHtml(release.target || '-')}</code>\nAuthor: ${escapeHtml(release.author || 'unknown')}\nPublished: ${escapeHtml(release.publishedAt || '-')}${flags ? `\nState: ${escapeHtml(flags)}` : ''}\n➖➖➖➖➖➖➖➖➖➖\n${body || '<i>بدون Release notes.</i>'}`,
366 + reply_markup: { inline_keyboard: [[{ text: '🔄 بروزرسانی', callback_data: `releasedetail:${repoId}:${releaseId}` }, { text: '🔙 Releases', callback_data: `releases:${repoId}` }]] }
367 };
368 }
369
@@ -377,8 +406,12 @@ function resolveReadCallback(data) {
406 if (prchecks) return { actionId: 'github.pr.checks.list', kind: 'prchecks', repoId: prchecks.repoId, prNumber: prchecks.itemId, page: prchecks.page };
407 const issues = pagedSingle(value, 'issues');
408 if (issues) return { actionId: 'github.issues.list', kind: 'issues', ...issues };
409 + const issuedetail = numericPair(value, 'issuedetail');
410 + if (issuedetail) return { actionId: 'github.issue.detail', kind: 'issuedetail', repoId: issuedetail.repoId, issueNumber: issuedetail.runId };
411 const releases = pagedSingle(value, 'releases');
412 if (releases) return { actionId: 'github.releases.list', kind: 'releases', ...releases };
413 + const releasedetail = numericPair(value, 'releasedetail');
414 + if (releasedetail) return { actionId: 'github.release.detail', kind: 'releasedetail', repoId: releasedetail.repoId, releaseId: releasedetail.runId };
415 for (const [prefix, actionId] of CALLBACK_ACTIONS) {
416 if (value.startsWith(prefix)) return { actionId, kind: 'legacy' };
417 }
@@ -454,7 +487,9 @@ export function createGitHubPlugin({ github, menu, workspaces } = {}) {
487 if (read.kind === 'prfiles') return pullRequestFilesView(github, read.repoId, read.prNumber, read.page);
488 if (read.kind === 'prchecks') return pullRequestChecksView(github, read.repoId, read.prNumber, read.page);
489 if (read.kind === 'issues') return issuesView(github, read.repoId, read.page);
490 + if (read.kind === 'issuedetail') return issueDetailView(github, read.repoId, read.issueNumber);
491 if (read.kind === 'releases') return releasesView(github, read.repoId, read.page);
492 + if (read.kind === 'releasedetail') return releaseDetailView(github, read.repoId, read.releaseId);
493 return menu.renderByCallback(data);
494 }
495 };