Skip to content

Commit 151a1ef

Browse files
tidy-devCopilot
andcommitted
fix: align JSDoc and error message with fallback behavior
Address review feedback: the docs/error now accurately reflect that COPILOT_GITHUB_TOKEN is a fallback (not prohibited), while still recommending GITHUB_TOKEN as the preferred token for repo API calls. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent af6ba45 commit 151a1ef

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

dist/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36211,15 +36211,15 @@ async function findPRsViaMergeCommits(baseRef, headRef) {
3621136211
}
3621236212
/**
3621336213
* Get the token for GitHub repo API calls (fetching PRs, comparing commits).
36214-
* Uses GITHUB_TOKEN which is automatically provided by GitHub Actions with
36215-
* appropriate repo permissions. COPILOT_GITHUB_TOKEN is reserved for Copilot
36216-
* CLI authentication and may not have repo access.
36214+
* Prefer GITHUB_TOKEN, which is automatically provided by GitHub Actions with
36215+
* appropriate repo permissions. Fall back to COPILOT_GITHUB_TOKEN if needed,
36216+
* but it may not have repo access.
3621736217
*/
3621836218
function getApiToken() {
3621936219
const token = process.env.GITHUB_TOKEN || process.env.COPILOT_GITHUB_TOKEN;
3622036220
if (!token) {
36221-
throw new Error('GITHUB_TOKEN must be set for repo API calls. ' +
36222-
'COPILOT_GITHUB_TOKEN is used for Copilot CLI authentication only.');
36221+
throw new Error('Either GITHUB_TOKEN or COPILOT_GITHUB_TOKEN must be set for repo API calls. ' +
36222+
'Prefer GITHUB_TOKEN; COPILOT_GITHUB_TOKEN may not have sufficient repo permissions.');
3622336223
}
3622436224
return token;
3622536225
}

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/prs.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,17 @@ async function findPRsViaMergeCommits(
152152

153153
/**
154154
* Get the token for GitHub repo API calls (fetching PRs, comparing commits).
155-
* Uses GITHUB_TOKEN which is automatically provided by GitHub Actions with
156-
* appropriate repo permissions. COPILOT_GITHUB_TOKEN is reserved for Copilot
157-
* CLI authentication and may not have repo access.
155+
* Prefer GITHUB_TOKEN, which is automatically provided by GitHub Actions with
156+
* appropriate repo permissions. Fall back to COPILOT_GITHUB_TOKEN if needed,
157+
* but it may not have repo access.
158158
*/
159159
function getApiToken(): string {
160160
const token =
161161
process.env.GITHUB_TOKEN || process.env.COPILOT_GITHUB_TOKEN
162162
if (!token) {
163163
throw new Error(
164-
'GITHUB_TOKEN must be set for repo API calls. ' +
165-
'COPILOT_GITHUB_TOKEN is used for Copilot CLI authentication only.'
164+
'Either GITHUB_TOKEN or COPILOT_GITHUB_TOKEN must be set for repo API calls. ' +
165+
'Prefer GITHUB_TOKEN; COPILOT_GITHUB_TOKEN may not have sufficient repo permissions.'
166166
)
167167
}
168168
return token

0 commit comments

Comments
 (0)