Compare commits

...

22 Commits

Author SHA1 Message Date
Eric Clemmons a61fbea322 Merge pull request #429 from cloudflare/changeset-release/main
Version Packages
2026-05-12 15:34:29 -05:00
github-actions[bot] e804ea3dfd Version Packages 2026-05-12 18:20:02 +00:00
Eric Clemmons 8d0324a88e fix: update release workflow to v5 actions and regenerate lockfile 2026-05-12 13:19:37 -05:00
Eric Clemmons 2f18b18a46 Merge pull request #431 from cloudflare/fix/semgrep-blocking-findings
fix: address Semgrep blocking findings
2026-05-12 13:10:33 -05:00
Eric Clemmons 622ff0d765 fix: upgrade checkout and setup-node to v5 for Node 24 runtime 2026-05-12 13:02:33 -05:00
Eric Clemmons f501f05fbd fix: force GitHub actions to run on Node 24 via env var 2026-05-12 13:01:47 -05:00
Eric Clemmons f990691b6b fix: resolve npm audit vulnerabilities via undici override and vitest v3 2026-05-12 11:58:45 -05:00
Eric Clemmons 652762d3f6 fix: migrate action runtime from node20 to node24 2026-05-12 11:43:52 -05:00
Eric Clemmons bd3f4f0b30 fix: add retry support to worker health check using better-result
Replace manual fetch() with Result.tryPromise from better-result,
which provides built-in retry with exponential backoff. This handles
the transient 404s that occur immediately after wrangler deploy due
to edge propagation delays.

- Rename workerHealthCheck.cjs -> .mjs for ESM support
- Add better-result as devDependency
- Update deploy.yml to invoke .mjs file
- Retry up to 5 times with 2s exponential backoff
2026-05-11 16:35:22 -05:00
Eric Clemmons 38dbf5b59f Merge pull request #428 from cloudflare/hrushikesh/add-semgrep-oss-workflow
ci: add Semgrep OSS scanning workflow
2026-05-11 15:04:44 -05:00
Eric Clemmons cdf65921e0 ci: pin pnpm to v10 to fix build script failures 2026-05-11 14:55:57 -05:00
Eric Clemmons bfdfae5e0f fix: address Semgrep blocking findings
- Replace execSync(`curl`) with native fetch() in workerHealthCheck.cjs
  to resolve javascript.lang.security.detect-child-process finding.
- Run npm audit fix to update rollup 4.34.4 -> 4.60.3 and vite 5.4.14 -> 5.4.21,
  resolving CVE-2026-27606 and other supply chain vulnerabilities.
2026-05-11 14:51:16 -05:00
Eric Clemmons a3edea85f7 style: fix prettier formatting in semgrep.yml 2026-05-11 14:10:07 -05:00
Eric Clemmons b6290ea70c Merge pull request #412 from cloudflare/BANDA-1664/wrangler-v4-support
Update default Wrangler version to v4.x
2026-05-11 13:55:58 -05:00
Eric Clemmons 65553b39e6 Clarify v4@latest is installed, not 4.72.0
Co-authored-by: Eric Clemmons <eric@smarterspam.com>
2026-04-26 13:56:44 -05:00
Hrushikesh Deshpande 4f154b96e0 ci: add Semgrep OSS scanning workflow 2026-04-23 18:36:26 -04:00
Somhairle MacLeòid 5f269ee58e Merge pull request #424 from ulgens/update-docs-checkout-action
Update actions/checkout in example code blocks
2026-04-17 12:00:59 +01:00
Eric Clemmons 3c924dd85f Default to 4, not 4.72.0 2026-04-15 15:39:44 -05:00
Eric Clemmons c1f90e624b major, not minor, version bump 2026-04-15 15:39:04 -05:00
Ülgen Sarıkavak 59b83385d8 Update actions/checkout in example code blocks
Similar to https://github.com/cloudflare/cloudflare-docs/pull/29846
2026-04-14 18:04:30 +03:00
Eric Clemmons dd8ea1b72d Clarify Wrangler v3 Support
Co-authored-by: Ben <4991309+NuroDev@users.noreply.github.com>
2026-03-24 15:36:43 -05:00
Eric Clemmons 1029e90033 Update default Wrangler version to v4 (4.72.0)
The action now defaults to Wrangler v4 instead of v3. All existing
version-gated logic (secret upload, deploy vs publish) correctly
handles v4. Users can pin to v3 via wranglerVersion input.

Closes BANDA-1664
2026-03-12 17:51:09 -05:00
14 changed files with 1628 additions and 990 deletions
+6 -7
View File
@@ -9,13 +9,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v5
with:
# Pinned due to compatibility issues on 23.2.0
node-version: "22"
node-version: "24"
cache: "npm"
- name: Install modules and build
@@ -76,7 +75,7 @@ jobs:
SECRET2: ${{ secrets.SECRET2 }}
- name: Health Check Deployed Worker
run: node .github/workflows/workerHealthCheck.cjs wrangler-action-test-secrets-v2
run: node .github/workflows/workerHealthCheck.ts wrangler-action-test-secrets-v2
shell: bash
- name: Deploy app secrets w/ default version
@@ -93,7 +92,7 @@ jobs:
SECRET2: ${{ secrets.SECRET2 }}
- name: Health Check Deployed Worker
run: node .github/workflows/workerHealthCheck.cjs wrangler-action-test-secrets-default
run: node .github/workflows/workerHealthCheck.ts wrangler-action-test-secrets-default
shell: bash
- name: Clean Up Deployed Workers
@@ -143,7 +142,7 @@ jobs:
command: deploy --dry-run
- name: Install pnpm
run: npm i -g pnpm
run: npm i -g pnpm@10
- name: Support pnpm package manager
uses: ./
+3 -4
View File
@@ -19,16 +19,15 @@ jobs:
issues: read
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v5
with:
# Pinned due to compatibility issues on 23.2.0
node-version: "22"
node-version: "24"
cache: "npm"
- name: Install modules
+23 -17
View File
@@ -1,24 +1,30 @@
name: Semgrep OSS scan
on:
pull_request: {}
workflow_dispatch: {}
push:
branches:
- main
- master
branches: [main, master]
workflow_dispatch: {}
schedule:
- cron: "0 0 * * *"
name: Semgrep config
- cron: "0 0 20 * *"
concurrency:
group: semgrep-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
semgrep:
name: semgrep/ci
runs-on: ubuntu-latest
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
SEMGREP_URL: https://cloudflare.semgrep.dev
SEMGREP_APP_URL: https://cloudflare.semgrep.dev
SEMGREP_VERSION_CHECK_URL: https://cloudflare.semgrep.dev/api/check-version
container:
image: semgrep/semgrep
name: semgrep-oss
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@v4
- run: semgrep ci
- uses: actions/checkout@v5
with:
fetch-depth: 1
- id: cache-semgrep
uses: actions/cache@v5
with:
path: ~/.local
key: semgrep-1.160.0-${{ runner.os }}
- if: steps.cache-semgrep.outputs.cache-hit != 'true'
run: pip install --user semgrep==1.160.0
- run: echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- run: semgrep scan --config=auto
-28
View File
@@ -1,28 +0,0 @@
const { execSync } = require("child_process");
function workerHealthCheck(workerName) {
const url = `https://${workerName}.devprod-testing7928.workers.dev/secret-health-check`;
const buffer = execSync(`curl ${url}`);
const response = buffer.toString();
if (response.includes("OK")) {
console.log(`Status: Worker is up! Response: ${response}`);
} else {
throw new Error(`Worker is down! Response: ${response}`);
}
return response;
}
const args = Array.from(process.argv);
const workerName = args.pop();
if (!workerName) {
throw new Error(
"Please provide the worker name as an argument when calling this program.",
);
}
workerHealthCheck(workerName);
+41
View File
@@ -0,0 +1,41 @@
import { Result } from "better-result";
async function workerHealthCheck(workerName) {
const url = `https://${workerName}.devprod-testing7928.workers.dev/secret-health-check`;
const response = await fetch(url);
const text = await response.text();
if (text.includes("OK")) {
console.log(`Status: Worker is up! Response: ${text}`);
} else {
throw new Error(`Worker is down! Response: ${text}`);
}
return text;
}
const args = Array.from(process.argv);
const workerName = args.pop();
if (!workerName) {
throw new Error(
"Please provide the worker name as an argument when calling this program.",
);
}
const result = await Result.tryPromise(() => workerHealthCheck(workerName), {
retry: {
times: 5,
delayMs: 2000,
backoff: "exponential",
},
});
result.match({
ok: () => {},
err: (error) => {
console.error(error);
process.exit(1);
},
});
+6 -1
View File
@@ -1,5 +1,11 @@
# Changelog
## 4.0.0
### Major Changes
- [#412](https://github.com/cloudflare/wrangler-action/pull/412) [`1029e90`](https://github.com/cloudflare/wrangler-action/commit/1029e90033977ccf46c2a9b3ddc55e42ad5da467) Thanks [@ericclemmons](https://github.com/ericclemmons)! - Update default Wrangler version to v4 (`latest`). The action now installs Wrangler v4 by default when no `wranglerVersion` input is specified. Users can still pin to v3 by setting `wranglerVersion: "3.90.0"` explicitly.
## 3.15.0
### Minor Changes
@@ -119,7 +125,6 @@
### Minor Changes
- [#213](https://github.com/cloudflare/wrangler-action/pull/213) [`d13856dfc92816473ebf47f66e263a2668a97896`](https://github.com/cloudflare/wrangler-action/commit/d13856dfc92816473ebf47f66e263a2668a97896) Thanks [@GrantBirki](https://github.com/GrantBirki)! - This change introduces three new GitHub Actions output variables. These variables are as follows:
- `command-output` - contains the string results of `stdout`
- `command-stderr` - contains the string results of `stderr`
- `deployment-url` - contains the string results of the URL that was deployed (ex: `https://<your_pages_site>.pages.dev`)
+18 -7
View File
@@ -2,6 +2,17 @@
Easy-to-use GitHub Action to use [Wrangler](https://developers.cloudflare.com/workers/cli-wrangler/). Makes deploying Workers a breeze.
## Wrangler v3 Support
The action now defaults to **Wrangler v4**. If you need to stay on Wrangler v3, you can pin the version explicitly:
```yaml
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
wranglerVersion: "3.90.0"
```
## Big Changes in v3
- Wrangler v1 is no longer supported.
@@ -27,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
@@ -155,7 +166,7 @@ jobs:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
@@ -179,7 +190,7 @@ jobs:
contents: read
deployments: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
@@ -204,7 +215,7 @@ jobs:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Deploy app
uses: cloudflare/wrangler-action@v3
with:
@@ -230,7 +241,7 @@ jobs:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Deploy app
uses: cloudflare/wrangler-action@v3
with:
@@ -250,7 +261,7 @@ jobs:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Upload Worker Version
uses: cloudflare/wrangler-action@v3
with:
@@ -376,7 +387,7 @@ jobs:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Deploy app
uses: cloudflare/wrangler-action@v3
with:
+1 -1
View File
@@ -5,7 +5,7 @@ branding:
description: "Deploy your Cloudflare projects from GitHub using Wrangler"
runs:
# Possible values: https://github.com/actions/runner/blob/main/src/Runner.Common/Util/NodeUtil.cs#L9
using: "node20"
using: "node24"
main: "dist/index.mjs"
inputs:
apiToken:
+1490 -921
View File
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -1,6 +1,6 @@
{
"name": "wrangler-action",
"version": "3.15.0",
"version": "4.0.0",
"description": "GitHub Action to use [Wrangler](https://developers.cloudflare.com/workers/cli-wrangler/).",
"author": "wrangler@cloudflare.com",
"license": "MIT OR Apache-2.0",
@@ -42,11 +42,15 @@
"@types/node": "^22.9.0",
"@types/semver": "^7.5.8",
"@vercel/ncc": "^0.38.2",
"better-result": "^2.9.2",
"mock-fs": "^5.4.1",
"msw": "^2.6.4",
"prettier": "^3.3.3",
"semver": "^7.6.3",
"typescript": "^5.6.3",
"vitest": "^2.1.9"
"vitest": "^3.2.4"
},
"overrides": {
"undici": "^6.23.1"
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { getPackageManager } from "./packageManagers";
import { checkWorkingDirectory } from "./utils";
import { main, WranglerActionConfig } from "./wranglerAction";
const DEFAULT_WRANGLER_VERSION = "3.90.0";
const DEFAULT_WRANGLER_VERSION = "4";
/**
* A configuration object that contains all the inputs & immutable state for the action.
+1 -1
View File
@@ -7,7 +7,7 @@ export function getTestConfig({
} = {}): WranglerActionConfig {
return Object.assign(
{
WRANGLER_VERSION: "3.81.0",
WRANGLER_VERSION: "4.72.0",
didUserProvideWranglerVersion: false,
secrets: [],
workingDirectory: "/src/test/fixtures",
+4
View File
@@ -42,6 +42,10 @@ describe("semverCompare", () => {
["3.1.0", "3.15.0", true],
["3.10.0", "3.1.0", false],
["3.20.0", "3.2.0", false],
["3.1.0", "4.0.0", true],
["2.20.0", "4.72.0", true],
["3.4.0", "4.72.0", true],
["3.60.0", "4.72.0", true],
["3.1.0", "latest", true],
["4.0.0", "latest", true],
])(
+28
View File
@@ -410,6 +410,34 @@ describe("uploadSecrets", () => {
expect(startGroup).toBeCalledWith("🔑 Uploading secrets...");
expect(endGroup).toHaveBeenCalledOnce();
});
it("WRANGLER_VERSION 4.x uses wrangler secret bulk", async () => {
vi.stubEnv("FAKE_SECRET", "FAKE_VALUE");
const testConfig = getTestConfig({
config: {
WRANGLER_VERSION: "4.72.0",
didUserProvideWranglerVersion: true,
secrets: ["FAKE_SECRET"],
},
});
vi.spyOn(exec, "exec").mockImplementation(async (cmd, args) => {
expect(cmd).toBe("npx");
expect(args).toStrictEqual([
"wrangler",
"secret",
"bulk",
"--env",
"dev",
]);
return 0;
});
const startGroup = vi.spyOn(core, "startGroup");
const endGroup = vi.spyOn(core, "endGroup");
await uploadSecrets(testConfig, testPackageManager);
expect(startGroup).toBeCalledWith("🔑 Uploading secrets...");
expect(endGroup).toHaveBeenCalledOnce();
});
});
describe("main", () => {