Compare commits

..

17 Commits

Author SHA1 Message Date
github-actions[bot] 168bc28b70 Automatic compilation 2024-10-02 14:52:32 +00:00
Maximo Guk 66334dff0a Merge pull request #297 from cloudflare/changeset-release/main
Version Packages
2024-10-02 11:46:26 -03:00
github-actions[bot] 9966912c1b Version Packages 2024-10-01 22:12:10 +00:00
Maximo Guk 7b9aec5185 Merge pull request #291 from Ambroos/add-pages-deployment-alias
Add deployment-alias-url for pages deployments with Wrangler 3.78.0+
2024-10-01 19:11:49 -03:00
Maximo Guk bcff5386ec Merge pull request #294 from Cherry/chore/bun-lockfile-new
chore: add support for new bun.lock
2024-09-26 12:38:45 -03:00
Maximo Guk c15498da36 Merge pull request #293 from cloudflare/hrushikeshdeshpande-updating-semgrep-docker-image
Updating semgrep docker image for the exising semgrep workflow.
2024-09-26 12:32:17 -03:00
James Ross 8bc5c5f050 chore: add support for new bun.lock 2024-09-26 01:02:47 +01:00
Hrushikesh Deshpande ac21b71592 Updating semgrep docker image for the exising semgrep workflow. 2024-09-25 18:32:41 -04:00
Maximo Guk f111269956 Merge pull request #292 from cloudflare/hrushikeshdeshpande-updating-semgrep-yml
Update semgrep.yml
2024-09-21 12:54:17 -05:00
hrushikeshdeshpande 570d521df6 Update semgrep.yml
Updating Semgrep.yml file - Semgrep is a tool that will be used to scan Cloudflare's public repos for Supply chain, code and secrets. This work is part of Application & Product Security team's initiative to onboard Semgrep onto all of Cloudflare's public repos.

In case of any questions, please reach out to "Hrushikesh Deshpande" on cf internal chat.
2024-09-21 12:06:53 -04:00
Hrushikesh Deshpande 174337b3b4 Adding semgrep yaml file 2024-09-19 21:54:02 -04:00
Ambroos Vaes a1467a0c8f Add deployment-alias-url for pages deployments with Wrangler 3.78.0+ 2024-09-19 18:54:02 +02:00
Maximo Guk 3ea6e3f132 Merge pull request #272 from cloudflare/changeset-release/main
Version Packages
2024-07-02 08:31:12 -05:00
github-actions[bot] ea11499226 Version Packages 2024-06-20 21:23:25 +00:00
Maximo Guk 8f2f89521c Merge pull request #271 from cloudflare/maximo/fixup-235
Unreverts #235 and don't automatically install wrangler when checking if it present
2024-06-20 16:23:02 -05:00
Maximo Guk 66efca2cbb Invoke wrangler to check if it's installed, but don't auto-install through npx/bunx 2024-06-15 23:22:47 -05:00
Maximo Guk aa5d18dd1e Revert "Revert "(feat): Use existing wrangler installation when appropriate (#235)""
This reverts commit 2d275a8f2d.
2024-06-15 22:57:11 -05:00
2 changed files with 74 additions and 3 deletions
+2
View File
@@ -51,3 +51,5 @@ outputs:
description: "The error output of the Wrangler command (comes from stderr)"
deployment-url:
description: "If the command was a Workers or Pages deployment, this will be the URL of the deployment"
deployment-alias-url:
description: "If the command was a Workers or Pages deployment, this can be the URL of the deployment alias (if it exists) - needs wrangler >= 3.78.0"
+72 -3
View File
@@ -3370,6 +3370,16 @@ const compare = (a, b, loose) =>
module.exports = compare
/***/ }),
/***/ 1898:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const compare = __nccwpck_require__(4309)
const eq = (a, b, loose) => compare(a, b, loose) === 0
module.exports = eq
/***/ }),
/***/ 4123:
@@ -28608,14 +28618,17 @@ __nccwpck_require__.d(__webpack_exports__, {
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js
var core = __nccwpck_require__(2186);
// EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js
var exec = __nccwpck_require__(1514);
// EXTERNAL MODULE: ./node_modules/semver/functions/eq.js
var eq = __nccwpck_require__(1898);
var eq_default = /*#__PURE__*/__nccwpck_require__.n(eq);
;// CONCATENATED MODULE: external "node:child_process"
const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
;// CONCATENATED MODULE: external "node:os"
const external_node_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:os");
// EXTERNAL MODULE: external "node:util"
var external_node_util_ = __nccwpck_require__(7261);
// EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js
var exec = __nccwpck_require__(1514);
;// CONCATENATED MODULE: ./src/exec.ts
@@ -28686,18 +28699,22 @@ const PACKAGE_MANAGERS = {
npm: {
install: "npm i",
exec: "npx",
execNoInstall: "npx --no-install",
},
yarn: {
install: "yarn add",
exec: "yarn",
execNoInstall: "yarn",
},
pnpm: {
install: "pnpm add",
exec: "pnpm exec",
execNoInstall: "pnpm exec",
},
bun: {
install: "bun i",
exec: "bunx",
execNoInstall: "bun run",
},
};
function detectPackageManager(workingDirectory = ".") {
@@ -28710,7 +28727,8 @@ function detectPackageManager(workingDirectory = ".") {
if ((0,external_node_fs_namespaceObject.existsSync)(external_node_path_namespaceObject.join(workingDirectory, "pnpm-lock.yaml"))) {
return "pnpm";
}
if ((0,external_node_fs_namespaceObject.existsSync)(external_node_path_namespaceObject.join(workingDirectory, "bun.lockb"))) {
if ((0,external_node_fs_namespaceObject.existsSync)(external_node_path_namespaceObject.join(workingDirectory, "bun.lockb")) ||
(0,external_node_fs_namespaceObject.existsSync)(external_node_path_namespaceObject.join(workingDirectory, "bun.lock"))) {
return "bun";
}
return null;
@@ -28731,12 +28749,15 @@ function getPackageManager(name, { workingDirectory = "." } = {}) {
const DEFAULT_WRANGLER_VERSION = "3.13.2";
/**
* A configuration object that contains all the inputs & immutable state for the action.
*/
const config = {
WRANGLER_VERSION: (0,core.getInput)("wranglerVersion") || DEFAULT_WRANGLER_VERSION,
didUserProvideWranglerVersion: Boolean((0,core.getInput)("wranglerVersion")),
secrets: (0,core.getMultilineInput)("secrets"),
workingDirectory: checkWorkingDirectory((0,core.getInput)("workingDirectory")),
CLOUDFLARE_API_TOKEN: (0,core.getInput)("apiToken"),
@@ -28789,6 +28810,48 @@ async function installWrangler() {
if (config["WRANGLER_VERSION"].startsWith("1")) {
throw new Error(`Wrangler v1 is no longer supported by this action. Please use major version 2 or greater`);
}
startGroup("🔍 Checking for existing Wrangler installation");
let installedVersion = "";
let installedVersionSatisfiesRequirement = false;
try {
const { stdout } = await (0,exec.getExecOutput)(
// We want to simply invoke wrangler to check if it's installed, but don't want to auto-install it at this stage
packageManager.execNoInstall, ["wrangler", "--version"], {
cwd: config["workingDirectory"],
silent: config.QUIET_MODE,
});
// There are two possible outputs from `wrangler --version`:
// ` ⛅️ wrangler 3.48.0 (update available 3.53.1)`
// and
// `3.48.0`
const versionMatch = stdout.match(/wrangler (\d+\.\d+\.\d+)/) ??
stdout.match(/^(\d+\.\d+\.\d+)/);
if (versionMatch) {
installedVersion = versionMatch[1];
}
if (config.didUserProvideWranglerVersion) {
installedVersionSatisfiesRequirement = eq_default()(installedVersion, config["WRANGLER_VERSION"]);
}
if (!config.didUserProvideWranglerVersion && installedVersion) {
info(`✅ No wrangler version specified, using pre-installed wrangler version ${installedVersion}`, true);
endGroup();
return;
}
if (config.didUserProvideWranglerVersion &&
installedVersionSatisfiesRequirement) {
info(`✅ Using Wrangler ${installedVersion}`, true);
endGroup();
return;
}
info("⚠️ Wrangler not found or version is incompatible. Installing...", true);
}
catch (error) {
(0,core.debug)(`Error checking Wrangler version: ${error}`);
info("⚠️ Wrangler not found or version is incompatible. Installing...", true);
}
finally {
endGroup();
}
startGroup("📥 Installing Wrangler");
try {
await (0,exec.exec)(packageManager.install, [`wrangler@${config["WRANGLER_VERSION"]}`], {
@@ -28949,6 +29012,12 @@ async function wranglerCommands() {
deploymentUrl = deploymentUrlMatch[0].trim();
(0,core.setOutput)("deployment-url", deploymentUrl);
}
// And also try to extract the alias URL (since wrangler@3.78.0)
const aliasUrlMatch = stdOut.match(/alias URL: (https?:\/\/[a-zA-Z0-9-./]+)/);
if (aliasUrlMatch && aliasUrlMatch.length == 2 && aliasUrlMatch[1]) {
const aliasUrl = aliasUrlMatch[1].trim();
(0,core.setOutput)("deployment-alias-url", aliasUrl);
}
}
}
}