From 5f9d50b088e814650c652aa5691559c1fa4ea9da Mon Sep 17 00:00:00 2001 From: matttrach Date: Mon, 18 Aug 2025 16:46:24 -0500 Subject: [PATCH] fix: add automation to generate sub issues Signed-off-by: matttrach --- .github/workflows/backport.yml | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/backport.yml diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml new file mode 100644 index 0000000..8dc822e --- /dev/null +++ b/.github/workflows/backport.yml @@ -0,0 +1,50 @@ +name: Backports + +on: + issues: + types: [labeled] # triggered when any label is added to an issue + +jobs: + create-issue: + runs-on: ubuntu-latest + if: ${{ github.event.label.name == 'version/v0' }} + steps: + - name: Create GitHub Issue + 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; + + // 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 subIssueId = createIssue.issue.id; + // const subIssueNumber = createIssue.issue.number;