Summary
When isscope is configured with a GitHub token that lacks the repo scope (only public_repo), triaging a private repository returns a generic error with no guidance. Users do not know what permission is missing.
Current Behavior
A 404 response from the GitHub API on a private repository returns a toast: "Repository not found." The actual cause (missing repo token scope) is not communicated.
Expected Behavior
The error message should detect the 404 on a known-private repository and explain that the configured token needs the repo scope to access private repositories, with a link to GitHub's token settings page.
Proposed Fix
async function fetchIssue(owner: string, repo: string, number: number) {
const res = await fetch(`https://api.github.com/repos/${owner}/${repo}/issues/${number}`, {
headers: { Authorization: `Bearer ${token}` }
});
if (res.status === 404) {
const scopeHeader = res.headers.get('x-oauth-scopes') ?? '';
const hasRepoScope = scopeHeader.split(',').map(s => s.trim()).includes('repo');
if (!hasRepoScope) {
throw new PermissionError(
'Private repository access requires the `repo` OAuth scope. ' +
'Update your token at https://github.com/settings/tokens.'
);
}
throw new NotFoundError('Repository or issue not found.');
}
}
Show the PermissionError in a persistent banner (not a dismissable toast) with a "Update token" link.
Acceptance Criteria
Summary
When isscope is configured with a GitHub token that lacks the
reposcope (onlypublic_repo), triaging a private repository returns a generic error with no guidance. Users do not know what permission is missing.Current Behavior
A 404 response from the GitHub API on a private repository returns a toast: "Repository not found." The actual cause (missing
repotoken scope) is not communicated.Expected Behavior
The error message should detect the 404 on a known-private repository and explain that the configured token needs the
reposcope to access private repositories, with a link to GitHub's token settings page.Proposed Fix
Show the
PermissionErrorin a persistent banner (not a dismissable toast) with a "Update token" link.Acceptance Criteria
reposcope shows the permission error banner.