chatroom-cli 1.38.6 → 1.38.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.
package/dist/index.js CHANGED
@@ -75146,33 +75146,56 @@ 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
+ }));
75162
+ const legacyEntries = legacyStatuses.map((s) => {
75163
+ let status3;
75164
+ let conclusion;
75165
+ switch (s.state) {
75166
+ case "success":
75167
+ status3 = "completed";
75168
+ conclusion = "success";
75169
+ break;
75170
+ case "failure":
75171
+ case "error":
75172
+ status3 = "completed";
75173
+ conclusion = "failure";
75174
+ break;
75175
+ default:
75176
+ status3 = "in_progress";
75177
+ conclusion = null;
75166
75178
  }
75179
+ return {
75180
+ name: s.context,
75181
+ status: status3,
75182
+ conclusion
75183
+ };
75184
+ });
75185
+ const merged = [...modernEntries, ...legacyEntries];
75186
+ const FAILURE_CONCLUSIONS = new Set(["failure", "timed_out", "cancelled", "error"]);
75187
+ let state;
75188
+ if (merged.some((e) => e.conclusion !== null && FAILURE_CONCLUSIONS.has(e.conclusion))) {
75189
+ state = "failure";
75190
+ } else if (merged.some((e) => e.status !== "completed")) {
75191
+ state = "pending";
75192
+ } else {
75193
+ state = "success";
75167
75194
  }
75168
75195
  return {
75169
75196
  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
75197
+ checkRuns: merged,
75198
+ totalCount: merged.length
75176
75199
  };
75177
75200
  } catch {
75178
75201
  return null;
@@ -79308,5 +79331,5 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
79308
79331
  });
79309
79332
  program2.parse();
79310
79333
 
79311
- //# debugId=1884CBA22481288264756E2164756E21
79334
+ //# debugId=36B037430550455164756E2164756E21
79312
79335
  //# sourceMappingURL=index.js.map