Personal Telegram developer console for GitHub
fix: consolidate repository status navigation (#36)
Routes the existing Status/Tests button to the actionable workflow-run report and removes the duplicate CI/Actions entry. RED-first coverage and integration mocks verify workflow drill-down behavior. PR head CI #337 passed before merge.
davoodmehraban89 committed
Oct 4, 2026 at 18:02 UTC
00cc5d283d9c120b8b03b5c8f0d5ba83c1c201ca
4 files changed
+23
-9
src/plugins/github/plugin.js
+2
-1
@@ -95,7 +95,6 @@ const addRepoAdvancedButtons = (view, repoId) => {
95
const rows = [...(view?.reply_markup?.inline_keyboard || [])];
96
const insertAt = Math.max(0, rows.length - 1);
97
rows.splice(insertAt, 0,
98
- [{ text: '🧪 CI / Actions', callback_data: `runs:${repoId}` }],
98
[{ text: '🌿 Branches', callback_data: `branches:${repoId}` }],
99
[
100
{ text: '🐛 Issues', callback_data: `issues:${repoId}` },
@@ -418,6 +417,8 @@ function resolveReadCallback(data) {
417
if (commits !== null) return { actionId: 'github.commits.list', kind: 'commits', repoId: commits };
418
const commitdetail = commitDetailRef(value);
419
if (commitdetail) return { actionId: 'github.commit.detail', kind: 'commitdetail', ...commitdetail };
420
+ const legacyStatus = numericSingle(value, 'status');
421
+ if (legacyStatus !== null) return { actionId: 'github.workflow.runs.list', kind: 'runs', repoId: legacyStatus, page: 1 };
422
const runs = workflowRunsPage(value);
423
if (runs) return { actionId: 'github.workflow.runs.list', kind: 'runs', ...runs };
424
const run = numericPair(value, 'run');
test/github-advanced-plugin.test.js
+12
-3
@@ -15,7 +15,7 @@ function makeGitHub() {
15
return {
16
calls,
17
async getRepository(id) { return hit('getRepository', { id: String(id), name: 'nexa-dev-bot', defaultBranch: 'main' }); },
18
- async listWorkflowRuns() { return []; },
18
+ async listWorkflowRuns() { return [{ id: 77, name: 'CI', status: 'completed', conclusion: 'success', branch: 'main', sha: 'abc1234', runNumber: 44 }]; },
19
async getWorkflowRun(repo, run) { return hit('getWorkflowRun', { id: run, name: 'CI', status: 'completed', conclusion: 'failure', runNumber: 134, branch: 'main', sha: 'abc1234', event: 'push' }); },
20
async listWorkflowJobs() { return hit('listWorkflowJobs', [{ id: 88, name: 'test', status: 'completed', conclusion: 'failure', steps: [{ number: 1, name: 'Run tests', conclusion: 'failure' }] }]); },
21
async getWorkflowJob() { return hit('getWorkflowJob', { id: 88, name: 'test', status: 'completed', conclusion: 'failure', steps: [{ number: 1, name: 'Run tests', conclusion: 'failure' }] }); },
@@ -41,7 +41,7 @@ function makeMenu() {
41
async renderByCallback(data) {
42
if (String(data).startsWith('repo:')) {
43
const repoId = String(data).split(':')[1];
44
- return { text: 'repo', reply_markup: { inline_keyboard: [[{ text: 'PRها', callback_data: `pr:${repoId}` }], [{ text: 'back', callback_data: 'menu:repos' }]] } };
44
+ return { text: 'repo', reply_markup: { inline_keyboard: [[{ text: 'PRها', callback_data: `pr:${repoId}` }, { text: 'وضعیت', callback_data: `status:${repoId}` }], [{ text: 'back', callback_data: 'menu:repos' }]] } };
45
}
46
return { text: `legacy:${data}`, reply_markup: { inline_keyboard: [] } };
47
}
@@ -89,8 +89,9 @@ test('repository and workflow views expose Advanced READ navigation', async () =
89
const plugin = createGitHubPlugin({ github, menu: makeMenu() });
90
const repoView = await plugin.resolveCallback('repo:123').execute();
91
const repoCallbacks = callbacks(repoView);
92
- for (const expected of ['runs:123', 'branches:123', 'pr:123', 'issues:123', 'releases:123']) assert.ok(repoCallbacks.includes(expected), expected);
92
+ for (const expected of ['status:123', 'branches:123', 'pr:123', 'issues:123', 'releases:123']) assert.ok(repoCallbacks.includes(expected), expected);
93
assert.ok(!repoCallbacks.includes('prs:123'), 'repository view must not expose a duplicate advanced PR entry');
94
+ assert.ok(!repoCallbacks.includes('runs:123'), 'repository view must not expose a duplicate CI entry');
95
96
const runView = await plugin.resolveCallback('run:123:77').execute();
97
assert.ok(callbacks(runView).includes('artifacts:123:77'));
@@ -102,6 +103,14 @@ test('repository and workflow views expose Advanced READ navigation', async () =
103
assert.ok(callbacks(jobView).includes('joblog:123:88'));
104
});
105
106
+test('legacy repository status button resolves to actionable workflow runs', async () => {
107
+ const plugin = createGitHubPlugin({ github: makeGitHub(), menu: makeMenu() });
108
+ const route = plugin.resolveCallback('status:123');
109
+ assert.equal(route?.actionId, 'github.workflow.runs.list');
110
+ const view = await route.execute();
111
+ assert.ok(callbacks(view).includes('run:123:77'), 'repository status button must drill into workflow run detail');
112
+});
113
+
114
test('legacy repository PR button resolves to the actionable advanced PR report', async () => {
115
const plugin = createGitHubPlugin({ github: makeGitHub(), menu: makeMenu() });
116
const route = plugin.resolveCallback('pr:123');
test/github-plugin.test.js
+3
-3
@@ -137,7 +137,7 @@ test('GitHub plugin maps read callback families to declared actions without eage
137
['blob:123:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', 'github.blob.read'],
138
['pr:123', 'github.pr.advanced.list'],
139
['commits:123', 'github.commits.list'],
140
- ['status:123', 'github.status.read'],
140
+ ['status:123', 'github.workflow.runs.list'],
141
['runs:123', 'github.workflow.runs.list'],
142
['run:123:77', 'github.workflow.run.detail'],
143
['jobs:123:77', 'github.workflow.jobs.list']
@@ -155,12 +155,12 @@ test('GitHub plugin maps read callback families to declared actions without eage
155
}
156
});
157
158
-test('repository detail view is augmented with CI / Actions navigation without changing menu manager', async () => {
158
+test('repository detail view keeps its existing status entry without duplicate CI navigation', async () => {
159
const menu = makeMenu();
160
const plugin = createGitHubPlugin({ github: makeGitHub(), menu });
161
const view = await plugin.resolveCallback('repo:123').execute();
162
const buttons = view.reply_markup.inline_keyboard.flat();
163
- assert.ok(buttons.some(button => button.callback_data === 'runs:123'));
163
+ assert.ok(!buttons.some(button => button.callback_data === 'runs:123'));
164
});
165
166
test('GitHub plugin write callbacks expose compact approval metadata and defer provider calls', async () => {
test/navigation.test.js
+6
-2
@@ -63,8 +63,12 @@ function installApiMock() {
63
html_url: 'https://github.com/davoodmehraban89/demo/pull/7', user: { login: 'davoodmehraban89' }
64
}]);
65
if (value === 'https://api.github.com/repos/davoodmehraban89/demo/actions/runs?per_page=3') return json({ workflow_runs: [{
66
- name: 'CI', status: 'completed', conclusion: 'success', head_commit: { message: 'fix mobile menu' },
67
- html_url: 'https://github.com/davoodmehraban89/demo/actions/runs/1'
66
+ id: 1, name: 'CI', status: 'completed', conclusion: 'success', head_branch: 'main', head_sha: '1234567890abcdef1234567890abcdef12345678', run_number: 1,
67
+ head_commit: { message: 'fix mobile menu' }, html_url: 'https://github.com/davoodmehraban89/demo/actions/runs/1'
68
+ }] });
69
+ if (value === 'https://api.github.com/repos/davoodmehraban89/demo/actions/runs?per_page=10') return json({ workflow_runs: [{
70
+ id: 1, name: 'CI', status: 'completed', conclusion: 'success', head_branch: 'main', head_sha: '1234567890abcdef1234567890abcdef12345678', run_number: 1,
71
+ event: 'push', head_commit: { message: 'fix mobile menu' }, html_url: 'https://github.com/davoodmehraban89/demo/actions/runs/1'
72
}] });
73
return json({ message: 'Not Found' }, 404);
74
};