Currently netlify supports monorepos by not rebuilding apps if base directory of that app hasn’t changed. But deploy previews builds an app every time new PR is made regardless of contents of base directory of that app has changed or not.
Let me describe our use case: we have monorepo with server, admin, kitchen, and pos subfolders. Admin, kitchen, and pos apps wired to 3 separate netlify apps for CD and Deploy Previews. Now when developers create a PR with only server related changes, all 3 apps generated Deploy Previews for that PR. (Also sometimes they builds it again on commits to that PR ignoring previous builds).
Would be great if we could achieve following:
Don’t build any Deploy Previews if PR changes only the contents of server folder.
If new PR made with changes to admin folder, generate Deploy Previews only for admin app.
You can certainly write an ignore script to check this, @almas :
Will that workflow not be possible for you? I understand you’d like your config to be handled automagically and so would we all, but in this case you’ll have to do a bit of work since we made a “one size could fit all” feature
Hey, could you please provide more info on deploy context. I saw Build environment variables | Netlify Docs, but not yet sure how would I get the previous build context. Does netlify do git clone build branch?
You wouldn’t get the previous build context; it shouldn’t matter. We store separate cache for each context already
You could use a command like pwd to get the current directory if you need it. Your build will START from within the base directory, so hopefully that’s the information you need to build a solution without resorting to tactics like that though.