Skip to content

Commit 804e16a

Browse files
jhlee0409claude
andcommitted
fix(ci): separate auth tokens for main repo and tap repo access
The Homebrew cask sync step was using HOMEBREW_TAP_TOKEN as the github-token for all API calls, but this PAT only has access to the homebrew-tap repo. Main repo release/asset access now uses the default GITHUB_TOKEN, while tap repo operations use a separate Octokit instance with HOMEBREW_TAP_TOKEN. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2f76509 commit 804e16a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

.github/workflows/updater-release.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ jobs:
218218
env:
219219
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
220220
with:
221-
github-token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
222221
script: |
223222
const releaseId = ${{ needs.create-release.outputs.release_id }};
224223
const tapOwner = 'jhlee0409';
@@ -229,6 +228,11 @@ jobs:
229228
throw new Error('HOMEBREW_TAP_TOKEN is required to publish releases safely.');
230229
}
231230
231+
// 메인 레포 접근: 기본 GITHUB_TOKEN (github 객체)
232+
// tap 레포 접근: HOMEBREW_TAP_TOKEN (별도 Octokit)
233+
const { getOctokit } = require('@actions/github');
234+
const tapClient = getOctokit(process.env.HOMEBREW_TAP_TOKEN);
235+
232236
const { data: releaseData } = await github.rest.repos.getRelease({
233237
owner: context.repo.owner,
234238
repo: context.repo.repo,
@@ -284,7 +288,8 @@ jobs:
284288
285289
console.log(`🍺 Syncing Homebrew cask: v${version}, sha256=${sha256}`);
286290
287-
const { data: caskFile } = await github.rest.repos.getContent({
291+
// tap 레포 접근은 tapClient 사용
292+
const { data: caskFile } = await tapClient.rest.repos.getContent({
288293
owner: tapOwner,
289294
repo: tapRepo,
290295
path: caskPath,
@@ -301,7 +306,7 @@ jobs:
301306
.replace(/sha256\s+"[^"]+"/, `sha256 "${sha256}"`);
302307
303308
if (nextContent !== currentContent) {
304-
await github.rest.repos.createOrUpdateFileContents({
309+
await tapClient.rest.repos.createOrUpdateFileContents({
305310
owner: tapOwner,
306311
repo: tapRepo,
307312
path: caskPath,
@@ -323,7 +328,7 @@ jobs:
323328
console.log(`✅ Cask already up to date for v${version}`);
324329
}
325330
326-
const { data: verifyFile } = await github.rest.repos.getContent({
331+
const { data: verifyFile } = await tapClient.rest.repos.getContent({
327332
owner: tapOwner,
328333
repo: tapRepo,
329334
path: caskPath,

0 commit comments

Comments
 (0)