From d28f68e866efb528eadb6441e303a8c0a64f4d3f Mon Sep 17 00:00:00 2001 From: matttrach Date: Mon, 18 Aug 2025 19:05:49 -0500 Subject: [PATCH] fix: use new path to attach sub issue Signed-off-by: matttrach --- .github/workflows/backport.yml | 48 ++++++++++++---------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 8dc822e..82b8171 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -13,38 +13,24 @@ jobs: uses: actions/github-script@v7 with: script: | - const { owner, repo } = context.repo; - const parentIssueNumber = context.payload.issue.number; - - // Fetch repository and parent issue details - const { repository } = await github.graphql(` - query($owner: String!, $repo: String!, $issueNumber: Int!) { - repository(owner: $owner, name: $repo) { - id - issue(number: $issueNumber) { - id - } - } - } - `, { owner, repo, issueNumber: parentIssueNumber }); - - const repositoryId = repository.id; + const parentIssue = context.issue; + const parentIssueTitle = context.payload.issue.title; + const parentIssueNumber = parentIssue.number; // Create the sub-issue - const { createIssue } = await github.graphql(` - mutation($repositoryId: ID!, $title: String!, $body: String!) { - createIssue(input: {repositoryId: $repositoryId, title: $title, body: $body}) { - issue { - id - number - } - } - } - `, { - repositoryId, - title: "Backport #" + parentIssueNumber + " to release/v0", - body: "Backport #" + parentIssueNumber + " to release/v0" + const newIssue = await github.rest.issues.create({ + owner: parentIssue.owner, + repo: parentIssue.repo, + title: `Backport #" + parentIssueNumber + " to release/v0`, + body: `"Backport #" + parentIssueNumber + " to release/v0` }); - // const subIssueId = createIssue.issue.id; - // const subIssueNumber = createIssue.issue.number; + const subIssueId = newIssue.data.id; + + // Attach the sub-issue to the parent + await github.rest.issues.addSubIssue({ + owner: parentIssue.owner, + repo: parentIssue.repo, + issue_number: parentIssueNumber, + sub_issue_id: subIssueId + });