Cloudflare Pages - Private Repo Dependency

Is there a way to have a private repo dependency for the build action?


I have not used it. But reading from the docs here:
" Configuration and deployment"

It says: “Both private and public repositories are supported.”.

This means it should work.

If you simply mean can you build a Pages Site from a Private Repo on GitHub then Yes.

Not quite what I mean. My repository has a build dependency that is a private repo. For example, when doing npm install as part of the build process, it needs to have access to download a different private repo as a build dependency.

See here for using private packages:

Or are you trying to install dependency from a private GitHub repo of your own?

As mentioned in the page above:

In your Pages project's **Settings** > **Environment variables** , add a new [environment variable]( named NPM_TOKEN to the **Production** and **Preview** environments and paste the [read-only token you created]( as its value.

Trying to install the dependency from a private GitHub repo I own. It’s not published to any registry. So an environment variable won’t work. Unless the environment variable contained an SSH key to download it. Which would be kinda weird, I’m not sure that is a good security practice.