* Link an issue as a sub-issue to a parent issue * @param {string} parentNodeId - GraphQL node ID of the parent issue * @param {string} subIssueNodeId - GraphQL node ID of the sub-issue * @param {number} parentNumber - Parent issue number (for logging) * @param {number} subIssueNumber - Sub-issu
(parentNodeId, subIssueNodeId, parentNumber, subIssueNumber)
| 691 | * @param {number} subIssueNumber - Sub-issue number (for logging) |
| 692 | */ |
| 693 | async function linkSubIssue(parentNodeId, subIssueNodeId, parentNumber, subIssueNumber) { |
| 694 | core.info(`Linking issue #${subIssueNumber} as sub-issue of #${parentNumber}`); |
| 695 | |
| 696 | try { |
| 697 | // Use GraphQL to link the sub-issue |
| 698 | await github.graphql( |
| 699 | `mutation($parentId: ID!, $subIssueId: ID!) { |
| 700 | addSubIssue(input: {issueId: $parentId, subIssueId: $subIssueId}) { |
| 701 | issue { |
| 702 | id |
| 703 | number |
| 704 | } |
| 705 | subIssue { |
| 706 | id |
| 707 | number |
| 708 | } |
| 709 | } |
| 710 | }`, |
| 711 | { |
| 712 | parentId: parentNodeId, |
| 713 | subIssueId: subIssueNodeId, |
| 714 | } |
| 715 | ); |
| 716 | |
| 717 | core.info(`✓ Successfully linked #${subIssueNumber} as sub-issue of #${parentNumber}`); |
| 718 | } catch (error) { |
| 719 | const errorMessage = getErrorMessage(error); |
| 720 | if (errorMessage.includes("Field 'addSubIssue' doesn't exist") || errorMessage.includes("not yet available")) { |
| 721 | core.warning(`Sub-issue API not available. Issue #${subIssueNumber} created but not linked to parent.`); |
| 722 | } else { |
| 723 | core.warning(`Failed to link sub-issue: ${errorMessage}`); |
| 724 | } |
| 725 | } |
| 726 | } |
| 727 | |
| 728 | /** |
| 729 | * Build create_discussion errors context string from error environment variable |
no test coverage detected