MCPcopy Create free account
hub / github.com/github/gh-aw / getSubIssueCount

Function getSubIssueCount

actions/setup/js/sub_issue_helpers.cjs:16–41  ·  view source on GitHub ↗

* Gets the sub-issue count for a parent issue using GraphQL * @param {string} owner - Repository owner * @param {string} repo - Repository name * @param {number} issueNumber - Issue number * @returns {Promise } - Sub-issue count or null if query failed

(owner, repo, issueNumber)

Source from the content-addressed store, hash-verified

14 * @returns {Promise<number|null>} - Sub-issue count or null if query failed
15 */
16async function getSubIssueCount(owner, repo, issueNumber) {
17 try {
18 const subIssueQuery = `
19 query($owner: String!, $repo: String!, $issueNumber: Int!) {
20 repository(owner: $owner, name: $repo) {
21 issue(number: $issueNumber) {
22 subIssues(first: ${MAX_SUB_ISSUES + 1}) {
23 totalCount
24 }
25 }
26 }
27 }
28 `;
29
30 const result = await github.graphql(subIssueQuery, {
31 owner,
32 repo,
33 issueNumber,
34 });
35
36 return result?.repository?.issue?.subIssues?.totalCount || 0;
37 } catch (error) {
38 core.warning(`Could not check sub-issue count for #${issueNumber}: ${getErrorMessage(error)}`);
39 return null;
40 }
41}
42
43module.exports = {
44 MAX_SUB_ISSUES,

Callers 4

ensureParentIssueFunction · 0.85
searchForExistingParentFunction · 0.85

Calls 1

getErrorMessageFunction · 0.70

Tested by

no test coverage detected