Create label-subissues.yaml

This commit is contained in:
Chris Parsons 2026-03-10 13:40:44 -07:00 committed by GitHub
parent d784571f29
commit 50722531ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

35
.github/workflows/label-subissues.yaml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Label Subissues
on:
issues:
types: [opened, edited]
jobs:
apply-label:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Check for Parent and Label
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NODE_ID: ${{ github.event.issue.node_id }}
run: |
# Use GraphQL to check if this issue has a parent
PARENT_ID=$(gh api graphql -f query='
query($id: ID!) {
node(id: $id) {
... on Issue {
parent {
id
}
}
}
}' -f id=$ISSUE_NODE_ID --jq '.data.node.parent.id')
# If PARENT_ID is not null, it is a subissue
if [ "$PARENT_ID" != "null" ] && [ -n "$PARENT_ID" ]; then
echo "Subissue detected. Applying label..."
gh issue edit ${{ github.event.issue.number }} --add-label "subissue"
else
echo "This is a top-level issue."
fi