diff --git a/.github/workflows/alchemy.yml b/.github/workflows/alchemy.yml index 5b54f20..ab14a6f 100644 --- a/.github/workflows/alchemy.yml +++ b/.github/workflows/alchemy.yml @@ -18,7 +18,6 @@ concurrency: env: STAGE: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || 'prod' }} - PULL_REQUEST: ${{ github.event.pull_request.number }} jobs: deploy: @@ -57,6 +56,12 @@ jobs: CLOUDFLARE_ACCOUNT_ID: fe57d01d7ab41f60d00ba1aade20eb33 CLOUDFLARE_API_TOKEN: ${{ github.event_name != 'pull_request' && secrets.CLOUDFLARE_API_TOKEN || '' }} GITHUB_TOKEN: ${{ github.event_name == 'pull_request' && github.token || '' }} + - name: Update the stack comment + if: github.event_name == 'pull_request' + run: pnpm exec alchemy-convex stack-comment + env: + CONVEX_ACCESS_TOKEN: ${{ secrets.CONVEX_ACCESS_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} destroy: name: Destroy the preview diff --git a/alchemy.run.ts b/alchemy.run.ts index 141d736..e3623bd 100644 --- a/alchemy.run.ts +++ b/alchemy.run.ts @@ -21,6 +21,7 @@ const HUB_CALLBACK_PATH = "/auth/hub/callback"; export default Alchemy.Stack( "samebase/scout", { + // The GitHub provider has no resource here: it forgets the PreviewComment rows of older previews. providers: Layer.mergeAll(Convex.providers(), Cloudflare.providers(), GitHub.providers()), state: Convex.state({ team: "nicu" }), }, @@ -153,18 +154,6 @@ export default Alchemy.Stack( source: { path: "./convex", command: ["node", "./scripts/deploy-preview.ts"] }, }).pipe(adopt(true), Alchemy.RemovalPolicy.destroy()); - const github = yield* GitHub.GitHubEnv; - if (github?.pr) { - yield* GitHub.Comment("PreviewComment", { - owner: github.owner, - repository: github.repository, - issueNumber: github.pr, - body: Output.interpolate`Preview \`${stage}\`: ${site.siteUrl} -Deployment: ${site.url} -Dashboard: https://dashboard.convex.dev/d/${site.name}`, - }).pipe(Alchemy.RemovalPolicy.retain()); - } - return { url: site.siteUrl }; }), );