chatroom-cli 1.38.6 → 1.38.7

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.
package/dist/index.js CHANGED
@@ -75146,33 +75146,59 @@ async function getCommitStatusChecks(cwd, ref) {
75146
75146
  if (!repoSlug)
75147
75147
  return null;
75148
75148
  try {
75149
- const [checkRunsResult, statusResult] = await Promise.all([
75149
+ const [checkRunsResult, legacyStatusesResult] = await Promise.all([
75150
75150
  runCommand(`gh api repos/${repoSlug}/commits/${encodeURIComponent(ref)}/check-runs --jq '{check_runs: [.check_runs[] | {name: .name, status: .status, conclusion: .conclusion}], total_count: .total_count}'`, cwd),
75151
- runCommand(`gh api repos/${repoSlug}/commits/${encodeURIComponent(ref)}/status --jq '.state'`, cwd)
75151
+ runCommand(`gh api repos/${repoSlug}/commits/${encodeURIComponent(ref)}/statuses --jq '[group_by(.context)[] | max_by(.created_at) | {context: .context, state: .state, target_url: .target_url}]'`, cwd)
75152
75152
  ]);
75153
- if ("error" in checkRunsResult || "error" in statusResult)
75153
+ if ("error" in checkRunsResult || "error" in legacyStatusesResult)
75154
75154
  return null;
75155
75155
  const checkRunsData = JSON.parse(checkRunsResult.stdout.trim());
75156
- const combinedState = statusResult.stdout.trim() || "pending";
75157
- let state = combinedState;
75158
- if (checkRunsData.total_count > 0) {
75159
- const conclusions = checkRunsData.check_runs.map((cr) => cr.conclusion);
75160
- if (conclusions.some((c) => c === "failure" || c === "timed_out")) {
75161
- state = "failure";
75162
- } else if (conclusions.every((c) => c === "success" || c === "skipped" || c === "neutral")) {
75163
- state = "success";
75164
- } else if (checkRunsData.check_runs.some((cr) => cr.status !== "completed")) {
75165
- state = "pending";
75156
+ const legacyStatuses = JSON.parse(legacyStatusesResult.stdout.trim());
75157
+ const modernEntries = checkRunsData.check_runs.map((cr) => ({
75158
+ name: cr.name,
75159
+ status: cr.status,
75160
+ conclusion: cr.conclusion,
75161
+ source: "check-run"
75162
+ }));
75163
+ const legacyEntries = legacyStatuses.map((s) => {
75164
+ let status3;
75165
+ let conclusion;
75166
+ switch (s.state) {
75167
+ case "success":
75168
+ status3 = "completed";
75169
+ conclusion = "success";
75170
+ break;
75171
+ case "failure":
75172
+ case "error":
75173
+ status3 = "completed";
75174
+ conclusion = "failure";
75175
+ break;
75176
+ default:
75177
+ status3 = "in_progress";
75178
+ conclusion = null;
75166
75179
  }
75180
+ return {
75181
+ name: s.context,
75182
+ status: status3,
75183
+ conclusion,
75184
+ source: "status",
75185
+ url: s.target_url ?? null
75186
+ };
75187
+ });
75188
+ const merged = [...modernEntries, ...legacyEntries];
75189
+ const FAILURE_CONCLUSIONS = new Set(["failure", "timed_out", "cancelled", "error"]);
75190
+ let state;
75191
+ if (merged.some((e) => e.conclusion !== null && FAILURE_CONCLUSIONS.has(e.conclusion))) {
75192
+ state = "failure";
75193
+ } else if (merged.some((e) => e.status !== "completed")) {
75194
+ state = "pending";
75195
+ } else {
75196
+ state = "success";
75167
75197
  }
75168
75198
  return {
75169
75199
  state,
75170
- checkRuns: checkRunsData.check_runs.map((cr) => ({
75171
- name: cr.name,
75172
- status: cr.status,
75173
- conclusion: cr.conclusion
75174
- })),
75175
- totalCount: checkRunsData.total_count
75200
+ checkRuns: merged,
75201
+ totalCount: merged.length
75176
75202
  };
75177
75203
  } catch {
75178
75204
  return null;
@@ -79308,5 +79334,5 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
79308
79334
  });
79309
79335
  program2.parse();
79310
79336
 
79311
- //# debugId=1884CBA22481288264756E2164756E21
79337
+ //# debugId=5B0DF926AD89205364756E2164756E21
79312
79338
  //# sourceMappingURL=index.js.map