diff --git a/packages/wrangler/package.json b/packages/wrangler/package.json index 520c62f804e7..a6fe1d4a73e0 100644 --- a/packages/wrangler/package.json +++ b/packages/wrangler/package.json @@ -87,7 +87,8 @@ "source-map": "^0.6.1", "unenv": "npm:unenv-nightly@2.0.0-20241111-080453-894aa31", "workerd": "1.20241106.1", - "xxhash-wasm": "^1.0.1" + "xxhash-wasm": "^1.0.1", + "std-env": "^3.8.0" }, "devDependencies": { "@cloudflare/cli": "workspace:*", diff --git a/packages/wrangler/src/pages/deploy.ts b/packages/wrangler/src/pages/deploy.ts index 9f5174e24bd3..9ac3d098d109 100644 --- a/packages/wrangler/src/pages/deploy.ts +++ b/packages/wrangler/src/pages/deploy.ts @@ -1,3 +1,4 @@ +import { env, isCI, provider } from "std-env"; import { execSync } from "node:child_process"; import { deploy } from "../api/pages/deploy"; import { fetchResult } from "../cfetch"; @@ -296,6 +297,15 @@ export const Handler = async (args: PagesDeployArgs) => { throw new FatalError("Must specify a project name.", 1); } + if (isCI) { + switch(provider) { + case 'gitlab': + branch = env.CI_COMMIT_BRANCH + commitHash = env.CI_COMMIT_SHA + commitMessage = env.CI_COMMIT_MESSAGE + } + } + // We infer git info by default is not passed in let isGitDir = true; try { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 73acc46b8003..b24c295d239d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1720,6 +1720,9 @@ importers: source-map: specifier: ^0.6.1 version: 0.6.1 + std-env: + specifier: ^3.8.0 + version: 3.8.0 unenv: specifier: npm:unenv-nightly@2.0.0-20241111-080453-894aa31 version: unenv-nightly@2.0.0-20241111-080453-894aa31 @@ -7579,6 +7582,9 @@ packages: std-env@3.7.0: resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} + std-env@3.8.0: + resolution: {integrity: sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==} + stoppable@1.1.0: resolution: {integrity: sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==} engines: {node: '>=4', npm: '>=6'} @@ -14751,6 +14757,8 @@ snapshots: std-env@3.7.0: {} + std-env@3.8.0: {} + stoppable@1.1.0: {} stream-transform@2.1.3: