Interesting. Now I need to know what those of us who are already using wrangler-action to deploy our Pages project need to do. I’m using this workflow.
I got this error [custom build] /bin/sh: 1: ./build.sh: Permission denied and prompted chatGPT which recommended running chmod +x build.sh and pushing to the repo. Only then did the build go through
Pages has deploy hooks that can be triggered with external cron to rebuild the site at regular intervals. Workers has none of that and someone from CF’s support said “you can write a scheduled handler which then calls the webhook for triggering builds though”. Now I have to research how to do that and ChatGPT shows I will need another worker and a CI/CD workflow…quite convoluted.
I haven’t yet implemented this in the GitHub repository for the example site, but I’m pretty sure you can create a workflow (cron job) that checks out the repo, changes a file (e.g., updated_log.txt), then commits the change. This update would trigger the CF build.
I’ve added a workflow file to the GitHub repository for the example site. This triggers the Cloudflare Worker build at approximately 9:57 PM UTC every day.
The obvious downside of this approach is… 365 commits each year.
I use Gitlab. Is it easy to adapt that code? (the GitHub pages requirement for public repos to use Pages threw me off.)
Never Mind! I decided to just move Back to GitHub. Gitlab’s UI is complicated.
To answer your question, you can do exactly the same thing in a GitLab repository, though the scheduling itself is not handled within the workflow file (i.e., there are two steps).
I tried those steps but the pipeline kept failing. I just decided to move my 37k pages content adapter site to Netlify (I use CF Pages for the other projects but file limit is 20k).
This is unfortunate, but unlike GitHub, GitLab allows only one workflow file per repository. If you only need to create/update a timestamp file like the GitHub example above, this is a trivial exercise. But if you have another task (e.g., build on commit) this gets really complicated… to the point that I’m not going to spend any time on it.
I spent nearly 4 hours last night and today on it. But kept getting failed pipeline commits. I agree that there is no need to waste time if it works on GitHub.