Jorge Posted May 15, 2020 Posted May 15, 2020 Hi. I'm trying a new combo with Processwire + Gridsome + Netlify. My data is in Processwire, available via a custom API and I'm fetching it with Axios to the Gridsome data layer. Everytime I push my code to Github, Netlify will deploy a new version of the site with the updated content. What's missing is some kind of automation that allows me to commit & push to Github every time a page is saved in Processwire. Does anyone know how to do that or point me in the right direction? Thanks.
kongondo Posted May 15, 2020 Posted May 15, 2020 @Jorge, Welcome to the forums ? 23 minutes ago, Jorge said: What's missing is some kind of automation that allows me to commit & push to Github every time a page is saved in Processwire. There's 2 - 3 issues here: Every time a page is saved: Easily achieved using ProcessWire Hooks Commit and Push to Github: How are you currently doing this? Are you pushing from the server where you have installed ProcessWire? This is related to #1, basically, what you will do when you call your Hook Automation: Depend on your case this and #2 could be one and the same. Or this could be an independent process, e.g. a cron job triggered by #1 which then calls #2 1 1
horst Posted May 15, 2020 Posted May 15, 2020 Hi @Jorge, welcome to the forums. As Kongondo already said, you can or need to use a hook to inject your desired functionality. You can use one in the site/ready.php like this: $wire->addHookAfter('Pages::saved', null, function(HookEvent $event) { $page = $event->arguments(0); // now, after you have the page related to the hook event, check if it belongs to the pages / templates you want to process if('my-desired-templatename' != $page->template->name) return; if(!$page->mycheckbox_use_github) return; // after you definetly know that you want to process this page, execute what you want to ... }); Maybe a little OT, but also maybe useful for inspiration: 1 1
gmclelland Posted May 16, 2020 Posted May 16, 2020 If I remember correctly I think they do something similar on the https://processwire-recipes.com/ site using the code from https://github.com/processwire-recipes/ProcessRecipeInstaller Markdown files are stored in this repo https://github.com/processwire-recipes/Recipes Maybe that can give you some ideas? 1 1
Jorge Posted May 18, 2020 Author Posted May 18, 2020 @kongondo, thanks. 2. It isn't but it could be. @horst, that module looks like a gem. Thank you. @gmclelland, I'm sure it will help me. Thanks guys. I do have a better ideia about what can be done and I'll try it in the coming days. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now