From ed98aab20bb0953a3c9c9a5de2b6a07538d67570 Mon Sep 17 00:00:00 2001 From: Maximo Guk <62088388+Maximo-Guk@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:09:16 -0500 Subject: [PATCH] Documents environment variables present in workers builds --- .../configuration/build-configuration.mdx | 1 + .../workers/ci-cd/builds/configuration.mdx | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/content/docs/pages/configuration/build-configuration.mdx b/src/content/docs/pages/configuration/build-configuration.mdx index cc5bbf8821e388e..bed9453758dc764 100644 --- a/src/content/docs/pages/configuration/build-configuration.mdx +++ b/src/content/docs/pages/configuration/build-configuration.mdx @@ -50,6 +50,7 @@ The following system environment variables are injected by default (but can be o | Environment Variable | Injected value | Example use-case | | --------------------- | ------------------------------------- | --------------------------------------------------------------------------------------- | +| `CI` | `true` | Changing build behaviour when run on CI versus locally | | `CF_PAGES` | `1` | Changing build behaviour when run on Pages versus locally | | `CF_PAGES_COMMIT_SHA` | `` | Passing current commit ID to error reporting, for example, Sentry | | `CF_PAGES_BRANCH` | `` | Customizing build based on branch, for example, disabling debug logging on `production` | diff --git a/src/content/docs/workers/ci-cd/builds/configuration.mdx b/src/content/docs/workers/ci-cd/builds/configuration.mdx index 217f17c98a74f1e..baf76c7fb72e090 100644 --- a/src/content/docs/workers/ci-cd/builds/configuration.mdx +++ b/src/content/docs/workers/ci-cd/builds/configuration.mdx @@ -78,4 +78,23 @@ It is recommended to consistently use the same API token across all uploads and [Static assets](/workers/static-assets/) and [frameworks](/workers/framework-guides/) are now supported in Cloudflare Workers. Learn to set up Workers projects and the commands for each framework in the framework guides: - \ No newline at end of file + + +## Environment variables + +You can provide custom environment variables to your build by configuring them in the Cloudflare dashboard: + +1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account. +2. In **Account Home**, select **Workers & Pages**. +3. In **Overview**, select your Worker. +4. Select **Settings** > **Environment variables**. + +The following system environment variables are injected by default (but can be overridden): + +| Environment Variable | Injected value | Example use-case | +| ----------------------- | ------------------------------- | --------------------------------------------------------------------------------------- | +| `CI` | `true` | Changing build behaviour when run on CI versus locally | +| `WORKERS_CI` | `1` | Changing build behaviour when run on Workers Builds versus locally | +| `WORKERS_CI_BUILD_UUID` | `` | Passing the Build UUID along to custom workflows | +| `WORKERS_CI_COMMIT_SHA` | `` | Passing current commit ID to error reporting, for example, Sentry | +| `WORKERS_CI_BRANCH` | `