fix: add automation to generate sub issues (#7)

Signed-off-by: matttrach <matt.trachier@suse.com>
This commit is contained in:
Matt Trachier 2025-08-18 18:12:44 -05:00 committed by GitHub
parent 3ad0663037
commit 5f092ac352
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 50 additions and 0 deletions

50
.github/workflows/backport.yml vendored Normal file
View File

@ -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;