MCPcopy Index your code
hub / github.com/remix-run/react-router / getIssueLabels

Function getIssueLabels

scripts/release-comments.ts:350–389  ·  view source on GitHub ↗
(number: string)

Source from the content-addressed store, hash-verified

348};
349
350function getIssueLabels(number: string): Array<string> {
351 let gql = String.raw;
352
353 let query = gql`
354 query ($owner: String!, $repo: String!, $number: Int!) {
355 repository(owner: $owner, name: $repo) {
356 issue(number: $number) {
357 number
358 title
359 url
360 labels(first: 25) {
361 nodes {
362 name
363 }
364 }
365 }
366 }
367 }
368 `;
369
370 let [owner, repo] = GITHUB_REPOSITORY.split("/");
371 let stdout = logAndExec(
372 [
373 "gh api graphql",
374 `--field owner=${owner}`,
375 `--field repo=${repo}`,
376 `--field number=${number}`,
377 `--raw-field query='${trimNewlines(query)}'`,
378 ],
379 true,
380 );
381
382 debug(stdout);
383
384 let parsed = JSON.parse(stdout);
385
386 return (parsed as IssueLabelsResult).data.repository.issue.labels.nodes.map(
387 (node) => node.name,
388 );
389}
390
391function trimNewlines(str: string) {
392 return str.replace(/[\n\r]+/g, "").replace(/ +/g, " ");

Callers 1

commentOnIssueFunction · 0.85

Calls 4

logAndExecFunction · 0.90
trimNewlinesFunction · 0.85
parseMethod · 0.80
debugFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…