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
7 changes: 6 additions & 1 deletion .github/workflows/alchemy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
13 changes: 1 addition & 12 deletions alchemy.run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" }),
},
Expand Down Expand Up @@ -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 };
}),
);
Loading