cloudflare/pages-action: any way to know CF_PAGES_URL ahead of running the action?
Hi,
I have a setup that's making use of the
CF_PAGES_URL
as described in docs
In my build I'm getting the id
out of it and I put it somewhere in assets. It's important to the setup because what comes out of the build is not served directly from the *.pages.dev
, but instead the root of *.pages.dev
is served as a path of some domain.
id
becomes part of path like this:
I have a bunch of previews
- ad-hoc previews on push to all branches (e.g. feature and fixes).
- several long-living branches, representing a shared testing envs. In my reverse proxy I'm using those known aliases to express where the "things" are
Then - and that's why I really need the id
to be known ahead of time - if my statics (ES modules) load something, I don't want them to load from alias. Things on it might have already been replaced.
I make them load from
(as mentioned). This way those are essentially permalink. That's what I'm after.
The address to the entrypoint, which I named autoloader.js
doesn't have :id
in it. It's
This setup works well - no problems.
But that's at a cost of actually having several long-living branches in repo origin.
And that bugs me. Or, rather, it confuses other guys in my team. They sometimes ask if we couldn't get rid of them (they're not that much into the "git-ops" concept as I am - I'm not blaming them, I'm stating the fact).
I'm looking for alternative, and I know there's cloudflare/pages-action
. I even use it in some other setups that don't depend on id
.
And it can be given the branch
. YEAH! I've got it!… but… there's this id
thing.
So, having all that written down: is there maybe a way to get the id
(or the whole url, as in automatic build) somehow in GHA but not as action Output, or if I'm dependent on id
I'm forced to use automatic deployments?1 Reply
Even if thres no way, I can just keep using my (now) long-living branches, but in an ephemeral way: push branch, let it be picked up by automatic deployments, be build, with
CF_PAGES_URL
, as it was so far.
Then I can automate removal from origin
right after that. But that's just more work than switch to Action - I want to make sure that the effort won't be wasted