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 +46 -20
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
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,
|
|
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)}/
|
|
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
|
|
75153
|
+
if ("error" in checkRunsResult || "error" in legacyStatusesResult)
|
|
75154
75154
|
return null;
|
|
75155
75155
|
const checkRunsData = JSON.parse(checkRunsResult.stdout.trim());
|
|
75156
|
-
const
|
|
75157
|
-
|
|
75158
|
-
|
|
75159
|
-
|
|
75160
|
-
|
|
75161
|
-
|
|
75162
|
-
|
|
75163
|
-
|
|
75164
|
-
|
|
75165
|
-
|
|
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:
|
|
75171
|
-
|
|
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=
|
|
79337
|
+
//# debugId=5B0DF926AD89205364756E2164756E21
|
|
79312
79338
|
//# sourceMappingURL=index.js.map
|