running code on preview destruction?

We need to add our preview urls to our auth system dynamically, and want to remove them after they’re merged or closed. Is there any way to run a job or hook when a preview is torn down?
5 Replies
maevyn
maevynOP15mo ago
ah, so previews are just never torn down legit 🙃 this makes things difficult
Chaika
Chaika15mo ago
Yea previews are forever, I don't know what you mean by adding them to your auth system "dynamically" though. if you just want to protect them, you can enable Cloudflare Access on them under Settings -> general -> Enable Access Policy and all of them would be behind CF Access
maevyn
maevynOP15mo ago
@chaika.me our company is an OAuth provider, all of our apps act as OAuth clients. Each app needs to have it's own client, and each client needs to have some config setup the primary config value we need to update is the allowed redirect-uris that's how the oauth server knows it's sending the credentials to the right URL and not just anywhere we need to add new preview URLs to that list, and remove them once they're no longer needed as our system can't handle infinite redirects on a client
maevyn
maevynOP15mo ago
GitHub
GitHub - schnerring/cloudflare-pages-branch-alias-action: A GitHub ...
A GitHub Action that generates a valid branch alias for Cloudflare Pages deployments from a Git branch name - GitHub - schnerring/cloudflare-pages-branch-alias-action: A GitHub Action that generate...
maevyn
maevynOP15mo ago
and predict the URL needed based on the branch name and remind our devs to only use the alias name and not the preview random string URL but it's a bit inconvenient, especially given there's no way to customize the Pages comment so that URL will always show up (and never work)
Want results from more Discord servers?
Add your server