MCPcopy Index your code
hub / github.com/21st-dev/1code / parseChecks

Function parseChecks

src/main/lib/git/github/github.ts:167–199  ·  view source on GitHub ↗
(rollup: GHPRResponse["statusCheckRollup"])

Source from the content-addressed store, hash-verified

165}
166
167function parseChecks(rollup: GHPRResponse["statusCheckRollup"]): CheckItem[] {
168 if (!rollup || rollup.length === 0) {
169 return [];
170 }
171
172 return rollup.map((ctx) => {
173 // CheckRun uses 'name', StatusContext uses 'context'
174 const name = ctx.name || ctx.context || "Unknown check";
175 // CheckRun uses 'detailsUrl', StatusContext uses 'targetUrl'
176 const url = ctx.detailsUrl || ctx.targetUrl;
177 // StatusContext uses 'state', CheckRun uses 'conclusion'
178 const rawStatus = ctx.state || ctx.conclusion;
179
180 let status: CheckItem["status"];
181 if (rawStatus === "SUCCESS") {
182 status = "success";
183 } else if (
184 rawStatus === "FAILURE" ||
185 rawStatus === "ERROR" ||
186 rawStatus === "TIMED_OUT"
187 ) {
188 status = "failure";
189 } else if (rawStatus === "SKIPPED" || rawStatus === "NEUTRAL") {
190 status = "skipped";
191 } else if (rawStatus === "CANCELLED") {
192 status = "cancelled";
193 } else {
194 status = "pending";
195 }
196
197 return { name, status, url };
198 });
199}
200
201function computeChecksStatus(
202 rollup: GHPRResponse["statusCheckRollup"],

Callers 1

getPRForBranchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected