Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Create `~/.config/opencode/opencode-auth-sync.json`:
|--------|------|---------|-------------|
| `enabled` | boolean | `true` | Enable/disable the plugin |
| `credentialsPath` | string | `~/.local/share/opencode/auth.json` | Path to OpenCode auth file |
| `secretName` | string | `OPENCODE_AUTH_JSON` | GitHub secret name |
| `secretName` | string | `OPENCODE_AUTH` | GitHub secret name |
| `repositories` | string[] | `[]` | Repositories to sync (`owner/repo` format) |
| `debounceMs` | number | `1000` | Debounce delay for file changes |

Expand All @@ -78,15 +78,15 @@ jobs:
- name: Setup OpenCode Auth
run: |
mkdir -p ~/.local/share/opencode
echo '${{ secrets.OPENCODE_AUTH_JSON }}' > ~/.local/share/opencode/auth.json
echo '${{ secrets.OPENCODE_AUTH }}' > ~/.local/share/opencode/auth.json
```

### Extracting Specific Tokens

```yaml
- name: Extract Anthropic Token
run: |
ANTHROPIC_TOKEN=$(echo '${{ secrets.OPENCODE_AUTH_JSON }}' | jq -r '.anthropic.access')
ANTHROPIC_TOKEN=$(echo '${{ secrets.OPENCODE_AUTH }}' | jq -r '.anthropic.access')
echo "::add-mask::$ANTHROPIC_TOKEN"
echo "ANTHROPIC_API_KEY=$ANTHROPIC_TOKEN" >> $GITHUB_ENV
```
Expand Down
4 changes: 2 additions & 2 deletions cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async function main() {
process.exit(0)
}

const existingSecretName = existingConfig.secretName || "OPENCODE_AUTH_JSON"
const existingSecretName = existingConfig.secretName || "OPENCODE_AUTH"
const secretName = await p.text({
message: "GitHub secret name",
placeholder: existingSecretName,
Expand Down Expand Up @@ -201,7 +201,7 @@ async function main() {
p.note(
[
`${color.dim("Plugin config:")} ~/.config/opencode/opencode-auth-sync.json`,
`${color.dim("Secret name:")} ${secretName || "OPENCODE_AUTH_JSON"}`,
`${color.dim("Secret name:")} ${secretName || "OPENCODE_AUTH"}`,
`${color.dim("Repositories:")} ${(selectedRepos as string[]).length} selected`,
"",
...((selectedRepos as string[]).map((r) => ` ${color.green("✓")} ${r}`)),
Expand Down
6 changes: 3 additions & 3 deletions lib/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ describe("config merge integration", () => {
enabled: true,
debounceMs: 10000,
credentialsPath: "~/.local/share/opencode/auth.json",
secretName: "OPENCODE_AUTH_JSON",
secretName: "OPENCODE_AUTH",
repositories: ["org/repo1", "org/repo2"],
}
writeFileSync(testConfigPath, JSON.stringify(originalConfig))

const loaded = loadPluginConfigSync(testConfigPath)
const reinstallUpdates = {
repositories: ["org/repo1", "org/repo3"],
secretName: "OPENCODE_AUTH_JSON",
secretName: "OPENCODE_AUTH",
}
const merged = mergeConfig(loaded, reinstallUpdates)

Expand All @@ -234,7 +234,7 @@ describe("DEFAULT_CONFIG", () => {
test("has expected default values", () => {
expect(DEFAULT_CONFIG.enabled).toBe(true)
expect(DEFAULT_CONFIG.credentialsPath).toBe("~/.local/share/opencode/auth.json")
expect(DEFAULT_CONFIG.secretName).toBe("OPENCODE_AUTH_JSON")
expect(DEFAULT_CONFIG.secretName).toBe("OPENCODE_AUTH")
expect(DEFAULT_CONFIG.repositories).toEqual([])
expect(DEFAULT_CONFIG.debounceMs).toBe(1000)
})
Expand Down
2 changes: 1 addition & 1 deletion lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { AuthSyncConfig } from "./types"
export const DEFAULT_CONFIG: AuthSyncConfig = {
enabled: true,
credentialsPath: "~/.local/share/opencode/auth.json",
secretName: "OPENCODE_AUTH_JSON",
secretName: "OPENCODE_AUTH",
repositories: [],
debounceMs: 1000,
}
Expand Down
2 changes: 1 addition & 1 deletion opencode-auth-sync.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://raw.githubusercontent.com/activadee/opencode-auth-sync/main/schema.json",
"enabled": true,
"credentialsPath": "~/.local/share/opencode/auth.json",
"secretName": "OPENCODE_AUTH_JSON",
"secretName": "OPENCODE_AUTH",
"repositories": [
"your-username/repo1",
"your-org/private-repo"
Expand Down
2 changes: 1 addition & 1 deletion schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"secretName": {
"type": "string",
"default": "OPENCODE_AUTH_JSON",
"default": "OPENCODE_AUTH",
"description": "Name of the GitHub secret to create/update"
},
"repositories": {
Expand Down