Cloudflare Pages - Private Repo Dependency

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

Hi,

I have not used it. But reading from the docs here:

https://developers.cloudflare.com/pages/get-started
" 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: https://developers.cloudflare.com/pages/how-to/npm-private-registry

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](https://developers.cloudflare.com/pages/platform/build-configuration#environment-variables) named NPM_TOKEN to the **Production** and **Preview** environments and paste the [read-only token you created](https://developers.cloudflare.com/pages/how-to/npm-private-registry#registry-access-token) 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.