Deploy is not updating publish folder (/docs) on github (site hosted on Github Pages)

Hi there,

I built a website using Eleventy that I’m hosting on Github Pages. I recently integrated Netlify CMS to this website but I have trouble updating the publish folder (/docs) in my Github repository after making changes from Netlify CMS.

Locally, my command “npm run build” builds a /docs folder (the static website) from the /_src folder. The /docs folder is part of my commit/push to Github so I can use Github Pages. Everything works fine when building and pushing from my local environment.

When I update the website from Netlify CMS, the deploy triggers as expected and run the “npm run build” command but only my source folder (/_src) is pushed and merged to my Github repository. The built folder (/docs) that I use to serve my site from on Github Pages is not part of the push and merge even though the command built it…

Here are my Build settings :

  • Repository: (private)
  • Base directory: Not set
  • Build command: npm run build
  • Publish directory: Not set (tried with “docs” but same issue)
    Builds: Active

More infos:

The few resources I found online:

My question is: how can I integrate the /docs folder to the push and merge after Netlify deploy?

Hope you could help me with that!


Hi @elechaudel and welcome to the community!
I can’t access (possible private?)
Just to clarify, your /docs is generated during the Netlify build process based on the content in /_src?
In that case you would need to find a way to push that content back to the repo from Netlify build.
One thing I can think of is to use a Netlify build plugin
You would also need to ignore builds when /docs changes:

Does that makes sense?

Hi @erez,

Thank you very much for your reply and your welcome message! :slight_smile:

I’m gonna have a look at the doc you sent me and try to implement your solution. I remember that @jlengstorf recently published a video on how to create a Netlify Build Plugin. I’ll start by refreshing my memory with this one!

Then, I’ll have to figure out why I need to ignore builds when /docs changes because that’s still not clear with my limited knowledge on that topic :slight_smile:

I’ll let you know my progress. Hope I will make it.

Thanks again for suggesting this solution!


1 Like

Hi @elechaudel, sorry for not being clear on that second part.

A build triggers on Netlify every time you make a commit to the repo (by default all commits to the default branch and commits to PRs).
You can control that here

If you commit back to the repo during your build process that will trigger another build which will commit back to the repo and trigger another build which will commit back to the repo and trigger another build, well you get my point…

You might not get all those builds since not all successive builds will generate changes to the /docs folder, but it is best to just ignore that folder.

Hopefully that makes sense :smiley: