@zerodeploy/cli 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +22 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5394,11 +5394,12 @@ function createProgressBar(options) {
5394
5394
  // src/utils/ci.ts
5395
5395
  function detectCI() {
5396
5396
  if (process.env.GITHUB_ACTIONS === "true") {
5397
+ const commitSha = getGitHubCommitSha();
5397
5398
  return {
5398
5399
  name: "github-actions",
5399
5400
  prNumber: extractGitHubPRNumber(),
5400
5401
  prTitle: null,
5401
- commitSha: process.env.GITHUB_SHA || null,
5402
+ commitSha,
5402
5403
  branch: process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME || null,
5403
5404
  commitMessage: null
5404
5405
  };
@@ -5466,6 +5467,21 @@ function detectCI() {
5466
5467
  }
5467
5468
  return null;
5468
5469
  }
5470
+ function getGitHubCommitSha() {
5471
+ if (process.env.GITHUB_EVENT_NAME === "pull_request") {
5472
+ const eventPath = process.env.GITHUB_EVENT_PATH;
5473
+ if (eventPath) {
5474
+ try {
5475
+ const { readFileSync: readFileSync2 } = __require("node:fs");
5476
+ const event = JSON.parse(readFileSync2(eventPath, "utf-8"));
5477
+ if (event?.pull_request?.head?.sha) {
5478
+ return event.pull_request.head.sha;
5479
+ }
5480
+ } catch {}
5481
+ }
5482
+ }
5483
+ return process.env.GITHUB_SHA || null;
5484
+ }
5469
5485
  function extractGitHubPRNumber() {
5470
5486
  const ref = process.env.GITHUB_REF;
5471
5487
  if (process.env.GITHUB_EVENT_NAME === "pull_request" && ref) {
@@ -5951,6 +5967,9 @@ Error: Build failed`);
5951
5967
  commitsToCheck.push(...parents);
5952
5968
  }
5953
5969
  } catch {}
5970
+ if (commitsToCheck.length > 1) {
5971
+ console.log(`Checking for existing deployment (commits: ${commitsToCheck.map((s) => s.slice(0, 7)).join(", ")})...`);
5972
+ }
5954
5973
  const findRes = await client.orgs[":orgSlug"].sites[":siteSlug"].deployments["by-commit"].$get({
5955
5974
  param: { orgSlug, siteSlug },
5956
5975
  query: { commits: commitsToCheck.join(",") }
@@ -6874,7 +6893,7 @@ var accountCommand = new Command2("account").description("Manage your ZeroDeploy
6874
6893
  }));
6875
6894
 
6876
6895
  // src/lib/version.ts
6877
- var VERSION = "0.1.6";
6896
+ var VERSION = "0.1.8";
6878
6897
 
6879
6898
  // src/commands/inspect.ts
6880
6899
  function getCommandByPath(rootCommand, path3) {
@@ -7003,7 +7022,7 @@ function createInspectCommand(rootProgram) {
7003
7022
  }
7004
7023
 
7005
7024
  // src/lib/version.ts
7006
- var VERSION2 = "0.1.6";
7025
+ var VERSION2 = "0.1.8";
7007
7026
 
7008
7027
  // src/lib/update-check.ts
7009
7028
  import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerodeploy/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zerodeploy": "dist/cli.js"