| 1 | import { GcpEnvironment } from "@/GCP/Environment"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { MinimumLogLevel } from "effect/References"; |
| 4 | |
| 5 | // Repositories live in a Secure Source Manager instance (billed, ~30 |
| 6 | // minutes to provision) and the API is disabled on the testing project: |
| 7 | // creates fail with Forbidden "Secure Source Manager API has not been used in |
| 8 | // project ... before or it is disabled". Set GCP_TEST_SECURE_SOURCE_MANAGER=1 |
| 9 | // plus GCP_TEST_SECURE_SOURCE_MANAGER_REPO on a project with an instance. |
| 10 | export const runLifecycle = |
| 11 | !process.env.FAST && !!process.env.GCP_TEST_SECURE_SOURCE_MANAGER; |
| 12 | |
| 13 | export const currentProject = GcpEnvironment.current.pipe( |
| 14 | Effect.map((env) => env.project), |
| 15 | ); |
| 16 | |
| 17 | export const missingRepoOf = (project: string) => |
| 18 | `projects/${project}/locations/us-central1/repositories/alchemy-missing-ssm-repo`; |
| 19 | |
| 20 | export const missingIssueOf = (project: string) => |
| 21 | `${missingRepoOf(project)}/issues/12345`; |
| 22 | |
| 23 | export const missingPullRequestOf = (project: string) => |
| 24 | `${missingRepoOf(project)}/pullRequests/12345`; |
| 25 | |
| 26 | export const logLevel = Effect.provideService( |
| 27 | MinimumLogLevel, |
| 28 | process.env.DEBUG ? "Debug" : "Info", |
| 29 | ); |