Skip to content

Commit 08f9bcc

Browse files
adds changelog for new default env vars in workers builds (#22988)
* adds changelog for new default env vars in workers builds * mentions that this is a previous Pages feature * updates title * Update src/content/changelog/workers/2025-06-10-default-env-vars.mdx Co-authored-by: Brendan Irvine-Broque <[email protected]> --------- Co-authored-by: Brendan Irvine-Broque <[email protected]>
1 parent bb69953 commit 08f9bcc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Access git commit sha and branch name as environment variables in Workers Builds
3+
description: Workers Builds now automatically injects environment variables containingGit metadata, including the commit SHA and branch name.
4+
products:
5+
- workers
6+
date: 2025-06-10T01:00:00Z
7+
---
8+
9+
[Workers Builds](/workers/ci-cd/builds/) connects your Worker to a [Git repository](/workers/ci-cd/builds/git-integration/), and automates building and deploying your code on each pushed change.
10+
11+
To make CI/CD pipelines even more flexible, Workers Builds now automatically injects [default environment variables](/workers/ci-cd/builds/configuration/#environment-variable) into your build process (much like the defaults in [Cloudflare Pages projects](/pages/configuration/build-configuration/#environment-variables)). You can use these variables to customize your build process based on the deployment context, such as the branch or commit.
12+
13+
The following environment variables are injected by default:
14+
15+
| Environment Variable | Injected value | Example use-case |
16+
| ----------------------- | ------------------------------- | --------------------------------------------------------------------------------------- |
17+
| `CI` | `true` | Changing build behavior when run on CI versus locally |
18+
| `WORKERS_CI` | `1` | Changing build behavior when run on Workers Builds versus locally |
19+
| `WORKERS_CI_BUILD_UUID` | `<build-uuid-of-current-build>` | Passing the Build UUID along to custom workflows |
20+
| `WORKERS_CI_COMMIT_SHA` | `<sha1-hash-of-current-commit>` | Passing current commit ID to error reporting, for example, Sentry |
21+
| `WORKERS_CI_BRANCH` | `<branch-name-from-push-event` | Customizing build based on branch, for example, disabling debug logging on `production` |
22+
23+
You can override these default values and add your own custom environment variables by navigating to **your Worker** > **Settings** > **Environment variables**.
24+
25+
Learn more in the [Build configuration documentation](/workers/ci-cd/builds/configuration/#environment-variables).

0 commit comments

Comments
 (0)