From 94abc2fb1053c5048c8949dbc9cf31ad14f5f141 Mon Sep 17 00:00:00 2001 From: perror Date: Thu, 11 May 2023 11:56:47 +0800 Subject: [PATCH] Add wranglerVersion options --- action.yml | 3 +++ index.js | 3 ++- src/index.ts | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 8d8d8e9..e04a32a 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,9 @@ inputs: workingDirectory: description: "The working directory in which to run Wrangler" required: false + wranglerVersion: + description: "The version of Wrangler to use" + required: false runs: using: "node16" main: "index.js" diff --git a/index.js b/index.js index 4d25674..e85ffef 100644 --- a/index.js +++ b/index.js @@ -22069,6 +22069,7 @@ try { const gitHubToken = (0, import_core.getInput)("gitHubToken", { required: false }); const branch = (0, import_core.getInput)("branch", { required: false }); const workingDirectory = (0, import_core.getInput)("workingDirectory", { required: false }); + const wranglerVersion = (0, import_core.getInput)("wranglerVersion", { required: false }) ? (0, import_core.getInput)("wranglerVersion", { required: false }) : "2"; const getProject = async () => { const response = await (0, import_undici.fetch)( `https://api.cloudflare.com/client/v4/accounts/${accountId}/pages/projects/${projectName}`, @@ -22084,7 +22085,7 @@ try { $ export CLOUDFLARE_ACCOUNT_ID="${accountId}" } - $$ npx wrangler@2 pages publish "${directory}" --project-name="${projectName}" --branch="${branch}" + $$ npx wrangler@${wranglerVersion} pages publish "${directory}" --project-name="${projectName}" --branch="${branch}" `; const response = await (0, import_undici.fetch)( `https://api.cloudflare.com/client/v4/accounts/${accountId}/pages/projects/${projectName}/deployments`, diff --git a/src/index.ts b/src/index.ts index a6fed3f..b82f841 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,6 +16,9 @@ try { const gitHubToken = getInput("gitHubToken", { required: false }); const branch = getInput("branch", { required: false }); const workingDirectory = getInput("workingDirectory", { required: false }); + const wranglerVersion = getInput("wranglerVersion", { required: false }) + ? getInput("wranglerVersion", { required: false }) + : "2"; const getProject = async () => { const response = await fetch( @@ -34,7 +37,7 @@ try { $ export CLOUDFLARE_ACCOUNT_ID="${accountId}" } - $$ npx wrangler@2 pages publish "${directory}" --project-name="${projectName}" --branch="${branch}" + $$ npx wrangler@${wranglerVersion} pages publish "${directory}" --project-name="${projectName}" --branch="${branch}" `; const response = await fetch( @@ -93,7 +96,7 @@ try { log_url: `https://dash.cloudflare.com/${accountId}/pages/view/${projectName}/${deploymentId}`, description: "Cloudflare Pages", state: "success", - auto_inactive: false + auto_inactive: false, }); };