Skip to content

Commit aa55701

Browse files
author
Frank
committed
sync
1 parent 73c8150 commit aa55701

2 files changed

Lines changed: 6 additions & 26 deletions

File tree

github/action.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ inputs:
1313
description: "Share the opencode session (defaults to true for public repos)"
1414
required: false
1515

16-
use_github_app:
17-
description: "Use GitHub App access token for authentication (defaults to true)"
16+
github_token:
17+
description: "GitHub access token to use for authentication. By default, the access token of the installed opencode GitHub app is used."
1818
required: false
1919

2020
runs:
@@ -24,14 +24,6 @@ runs:
2424
shell: bash
2525
run: curl -fsSL https://opencode.ai/install | bash
2626

27-
# - name: Run opencode
28-
# shell: bash
29-
# id: run_opencode
30-
# run: opencode github run
31-
# env:
32-
# MODEL: ${{ inputs.model }}
33-
# SHARE: ${{ inputs.share }}
34-
3527
- name: Install bun
3628
shell: bash
3729
run: npm install -g bun
@@ -48,4 +40,4 @@ runs:
4840
env:
4941
MODEL: ${{ inputs.model }}
5042
SHARE: ${{ inputs.share }}
51-
USE_GITHUB_APP: ${{ inputs.use_github_app }}
43+
GITHUB_TOKEN: ${{ inputs.github_token }}

github/index.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,8 @@ function useEnvMock() {
306306
}
307307
}
308308

309-
function useEnvGithubApp() {
310-
if (process.env["USE_GITHUB_APP"]?.toLowerCase() === "false") return false
311-
return true
309+
function useEnvGithubToken() {
310+
return process.env["GITHUB_TOKEN"]
312311
}
313312

314313
function isMock() {
@@ -338,7 +337,7 @@ function useShareUrl() {
338337
async function getAccessToken() {
339338
const { repo } = useContext()
340339

341-
if (!useEnvGithubApp()) return await core.getIDToken("opencode-github-action")
340+
if (!useEnvGithubToken()) return useEnvGithubToken()
342341

343342
let response
344343
if (isMock()) {
@@ -683,17 +682,6 @@ async function assertPermissions() {
683682
const { actor, repo } = useContext()
684683

685684
console.log(`Asserting permissions for user ${actor}...`)
686-
// TODO
687-
try {
688-
const collaborators = await octoRest.repos.listCollaborators({
689-
owner: repo.owner,
690-
repo: repo.repo,
691-
})
692-
console.log("COLLABS", collaborators)
693-
} catch (error) {
694-
console.error(`Failed to list collaborators: ${error}`)
695-
throw new Error(`Failed to list collaborators: ${error}`)
696-
}
697685

698686
let permission
699687
try {

0 commit comments

Comments
 (0)