Skip to content

Commit fd64220

Browse files
committed
fix(github-client): fetchLatestSemverTag throws instead of returning undefined when auth unavailable
getOctokit() was called outside the try/catch, so an AUTH_MISSING throw propagated as a test failure rather than the function silently returning undefined — the contract documented by the test's own guard. Moved getOctokit() inside the try block. Also explicitly passes GITHUB_TOKEN to the CI test step so integration tests have the Actions token available regardless of runner defaults.
1 parent 84aeaec commit fd64220

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
run: bun run check
3030

3131
- name: Unit tests with coverage
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3234
run: |
3335
bun run test:coverage 2>&1 | tee /tmp/coverage.txt
3436
node -e "

src/server/github-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ export async function fetchLatestSemverTag(
228228
owner: string,
229229
repo: string,
230230
): Promise<string | undefined> {
231-
const octokit = getOctokit();
232231
try {
232+
const octokit = getOctokit();
233233
const res = await octokit.repos.listTags({ owner, repo, per_page: 20 });
234234
const semverRe = /^v?\d+\.\d+\.\d+$/;
235235
return res.data.filter((t) => semverRe.test(t.name))[0]?.name;

0 commit comments

Comments
 (0)