mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
sync
This commit is contained in:
parent
0fd312346b
commit
98f021f38b
12 changed files with 1117 additions and 290 deletions
27
github/src/mock.ts
Normal file
27
github/src/mock.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import type { Context } from "@actions/github/lib/context"
|
||||
import { lazy } from "./lazy"
|
||||
|
||||
export namespace Mock {
|
||||
export const state = lazy(() => {
|
||||
const mockContext = process.env["MOCK_CONTEXT"]
|
||||
const mockToken = process.env["MOCK_TOKEN"]
|
||||
|
||||
return {
|
||||
isMock: Boolean(mockContext || mockToken),
|
||||
context: mockContext ? (JSON.parse(mockContext) as Context) : undefined,
|
||||
token: mockToken,
|
||||
}
|
||||
})
|
||||
|
||||
export function isMock() {
|
||||
return state().isMock
|
||||
}
|
||||
|
||||
export function context() {
|
||||
return state().context
|
||||
}
|
||||
|
||||
export function token() {
|
||||
return state().token
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue