Closed TonsiTT closed 6 months ago
Thanks @AdrianGonz97 .
Just a quick question, when I deploy using wrangler cli with
wrangler pages deploy .vercel/output/static --branch=Preview
I always receive the same Aliase URL in the dashboard: preview.PAGES_DOMAIN.pages.dev It helps greatly since I can use the same URL for automated testing, callbacks, etc.
Is there a way to get the same result using this action? I understand it's an opinionated action, so I won't ask for any modification; I'm just wondering how(if possible) to get the same result as I would from using Wrangler cli in this action. Perhaps by using some of the config options.
These are the options I tried using without success:
directory: .vercel/output/static
deploymentName: Preview
branch: Preview
@TonsiTT Ah, I understand what you're getting at and it's a fair request! I think we can make this possible with a small tweak 🙂.
At the moment, the only way to achieve your goal is to create a dedicated branch called preview
that would have to act as a sort of staging branch. When PRs/commits are merged/pushed to it, the workflow will execute and you'll get the desired preview URL.
That's a pretty icky workaround for such a simple use-case. We can do better.
Given that branch
is an optional input parameter, we should be able to just use it directly as the name of the branch if it's provided, which feels logical. If it's not set (i.e. for cases where you'd want the name to be unique, like PRs), then it's name will be inferred.
So in short, the example you provided should just work now. (This should now work as of https://github.com/AdrianGonz97/refined-cf-pages-action/pull/14)
Thanks so much!
Hi, So, I have a workflow which creates deployment when I push on the preview branch. However, the logic for this action checks for the existence of the PR branch owner, which isn't available on non-PR commits or commits on non Prod branch.
https://github.com/AdrianGonz97/refined-cf-pages-action/blob/bb15adef37e2c9a4dfc73436d33f45a58ecd5fec/src/cloudflare.ts#L30-L31
It leads to a branch preview url with a name like https://undefined-preview.XXX.pages.dev/