Skip to content

Commit 9e651ba

Browse files
actions-usergithub-actions[bot]
authored andcommitted
Daily Repo Goal Achiever: Fix typos and add Sub-Issue Closer workflow
1 parent 69b5e3a commit 9e651ba

7 files changed

Lines changed: 243 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ A sample family of reusable [GitHub Agentic Workflows](https://github.github.com
77
### Triage Workflows
88

99
- [🏷️ Issue Triage](docs/issue-triage.md) - Triage issues and pull requests
10+
- [🔒 Sub-Issue Closer](docs/sub-issue-closer.md) - Automatically close parent issues when all sub-issues are complete
1011

1112
## Fault Analysis Workflows
1213

docs/daily-qa.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# 🔍 Daily Adhoc QA
1+
# 🔍 Daily Ad hoc QA
22

33
> For an overview of all available workflows, see the [main README](../README.md).
44
5-
The [daily Adhoc QA workflow](../workflows/daily-qa.md?plain=1) will perform adhoc quality assurance tasks in the repository, such as following the instructions in the README.md, tutorials and walkthroughs to check that the code builds and runs, and that the getting started process is simple and works well. You can edit and configure the workflow to describe more tasks.
5+
The [daily Ad hoc QA workflow](../workflows/daily-qa.md?plain=1) will perform ad hoc quality assurance tasks in the repository, such as following the instructions in the README.md, tutorials and walkthroughs to check that the code builds and runs, and that the getting started process is simple and works well. You can edit and configure the workflow to describe more tasks.
66

77
## Installation
88

docs/sub-issue-closer.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# 🔒 Sub-Issue Closer
2+
3+
> For an overview of all available workflows, see the [main README](../README.md).
4+
5+
The [Sub-Issue Closer workflow](../workflows/sub-issue-closer.md?plain=1) automatically closes parent issues when all their sub-issues are 100% complete. This helps keep your issue tracker organized and reduces manual maintenance overhead when working with issue hierarchies.
6+
7+
## What It Does
8+
9+
1. Scans all open parent issues in the repository
10+
2. Checks the completion status of all sub-issues
11+
3. Recursively closes parent issues when all sub-issues are closed
12+
4. Adds explanatory comments to closed issues
13+
5. Provides a summary report of actions taken
14+
15+
## Why It's Useful
16+
17+
- **Reduces Manual Overhead**: No need to manually close parent issues after completing all sub-tasks
18+
- **Maintains Clean Issue Tracker**: Automatically keeps your issue list organized
19+
- **Recursive Processing**: Handles multi-level issue hierarchies intelligently
20+
- **Transparent Operations**: Adds clear comments explaining why issues were closed
21+
- **Conservative Approach**: Only closes when absolutely certain all sub-issues are complete
22+
23+
## Installation
24+
25+
```bash
26+
# Install the 'gh aw' extension
27+
gh extensions install github/gh-aw
28+
29+
# Add the workflow
30+
gh aw add githubnext/agentics/sub-issue-closer
31+
32+
# Compile to generate the GitHub Actions workflow
33+
gh aw compile
34+
```
35+
36+
## Customization
37+
38+
Edit `.github/workflows/sub-issue-closer.md` to adjust:
39+
40+
- **Schedule**: Change from `daily` to a specific cron schedule
41+
- **Limits**: Modify `max: 20` to process more or fewer issues per run
42+
- **Timeout**: Adjust `timeout-minutes` based on your repository size
43+
- **Comment format**: Customize the closure comment template
44+
45+
## How It Works
46+
47+
The workflow uses GitHub's issue tracking relationships to identify parent issues and their sub-issues. It processes the issue hierarchy bottom-up, ensuring that sub-issues are evaluated before their parents. This enables recursive closure up the tree as each level reaches 100% completion.
48+
49+
### Example Scenario
50+
51+
You have this issue hierarchy:
52+
53+
```
54+
Issue #10: "Major Feature Release" (OPEN)
55+
├─ Issue #11: "Backend changes" (OPEN)
56+
│ ├─ Issue #12: "API updates" (CLOSED)
57+
│ └─ Issue #13: "Database migration" (CLOSED)
58+
└─ Issue #14: "Frontend changes" (CLOSED)
59+
```
60+
61+
When you close Issue #13 (the last sub-issue of #11), the workflow will:
62+
1. Detect Issue #11 is now 100% complete → Close #11
63+
2. Check if Issue #10's sub-issues are complete → Detect #14 (closed) and #11 (now closed)
64+
3. Close Issue #10 since all its sub-issues are complete
65+
66+
## Safe Outputs
67+
68+
The workflow uses these safe output actions:
69+
70+
- **update-issue**: Closes parent issues (max 20 per run)
71+
- **add-comment**: Adds explanatory comments (max 20 per run)
72+
73+
All actions are logged and visible in the workflow run output.
74+
75+
## Permissions
76+
77+
Requires these permissions:
78+
- `contents: read` - To access repository structure
79+
- `issues: read` - To query issue relationships
80+
81+
## Best Practices
82+
83+
1. **Use clear issue hierarchies**: Structure issues with explicit parent-child relationships
84+
2. **Review closure comments**: Check the automated comments to ensure correct operation
85+
3. **Start with manual testing**: Run via workflow_dispatch first to observe behavior
86+
4. **Adjust limits as needed**: Increase max values if you have large issue hierarchies
87+
5. **Combine with event-driven workflows**: Consider adding a complementary workflow that runs when individual issues close
88+
89+
## Related Workflows
90+
91+
- [Issue Triage](issue-triage.md) - Automated issue categorization and labeling
92+
- [Daily Plan](daily-plan.md) - Update planning issues for team coordination

workflows/daily-qa.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: |
3-
This workflow performs adhoc quality assurance by validating project health daily.
3+
This workflow performs ad hoc quality assurance by validating project health daily.
44
Checks that code builds and runs, tests pass, documentation is clear, and code
55
is well-structured. Creates discussions for findings and can submit draft PRs
66
with improvements. Provides continuous quality monitoring throughout development.

workflows/daily-team-status.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: |
3-
This workflow created daily team status reporter creating upbeat activity summaries.
3+
This workflow is a daily team status reporter creating upbeat activity summaries.
44
Gathers recent repository activity (issues, PRs, discussions, releases, code changes)
55
and generates engaging GitHub issues with productivity insights, community
66
highlights, and project recommendations. Uses a positive, encouraging tone with

workflows/pr-fix.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ You are an AI assistant specialized in fixing pull requests with failing CI chec
4444

4545
4. Formulate a plan to follow the instructions. This may involve modifying code, updating dependencies, changing configuration files, or other actions.
4646

47-
4. Implement the changes needed to follow the instructions.
47+
5. Implement the changes needed to follow the instructions.
4848

4949
5. Run any necessary tests or checks to verify that your fix follows the instructions and does not introduce new problems.
5050

51-
6. Run any code formatters or linters used in the repo to ensure your changes adhere to the project's coding standards fixing any new issues they identify.
51+
6. Run any code formatters or linters used in the repo to ensure your changes adhere to the project's coding standards and fix any new issues they identify.
5252

5353
7. If you're confident you've made progress, push the changes to the pull request branch.
5454

workflows/sub-issue-closer.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
---
2+
description: Scheduled workflow that recursively closes parent issues when all sub-issues are 100% complete
3+
name: Sub-Issue Closer
4+
on:
5+
schedule: daily
6+
workflow_dispatch:
7+
permissions:
8+
contents: read
9+
issues: read
10+
engine: copilot
11+
timeout-minutes: 15
12+
tools:
13+
github:
14+
toolsets:
15+
- issues
16+
bash: true
17+
safe-outputs:
18+
update-issue:
19+
status:
20+
target: "*"
21+
max: 20
22+
add-comment:
23+
target: "*"
24+
max: 20
25+
messages:
26+
run-started: "🔒 Starting Sub-Issue Closer... [{workflow_name}]({run_url}) is checking for completed parent issues"
27+
run-success: "✅ Sub-Issue Closer complete! [{workflow_name}]({run_url}) has processed all parent issues."
28+
run-failure: "❌ Sub-Issue Closer failed! [{workflow_name}]({run_url}) {status}. Some issues may not be processed."
29+
---
30+
31+
# Sub-Issue Closer 🔒
32+
33+
You are an intelligent agent that automatically closes parent issues when all their sub-issues are 100% complete.
34+
35+
## Task
36+
37+
Recursively process GitHub issues in repository **${{ github.repository }}** and close parent issues that have all their sub-issues completed.
38+
39+
## Process
40+
41+
### Step 1: Find Open Parent Issues
42+
43+
Use the GitHub tools to search for open issues that have sub-issues. Look for:
44+
- Issues with state = "OPEN"
45+
- Issues that have tracked issues (sub-issues)
46+
- Issues that appear to be tracking/parent issues based on their structure
47+
48+
You can use the `search_issues` tool to find issues with sub-issues, or use `list_issues` to get all open issues and filter those with sub-issues.
49+
50+
### Step 2: Check Sub-Issue Completion
51+
52+
For each parent issue found, check the completion status of its sub-issues:
53+
54+
1. Get the sub-issues for the parent issue using the GitHub API
55+
2. Check if ALL sub-issues are in state "CLOSED"
56+
3. Calculate the completion percentage
57+
58+
**Completion Criteria:**
59+
- A parent issue is considered "100% complete" when ALL of its sub-issues are closed
60+
- If even one sub-issue is still open, the parent should remain open
61+
- Empty parent issues (no sub-issues) should be skipped
62+
63+
### Step 3: Recursive Processing
64+
65+
After closing a parent issue:
66+
1. Check if that issue itself is a sub-issue of another parent
67+
2. If it has a parent issue, check that parent's completion status
68+
3. Recursively close parent issues up the tree as they reach 100% completion
69+
70+
**Important:** Process the tree bottom-up to ensure sub-issues are evaluated before their parents.
71+
72+
### Step 4: Close Completed Parent Issues
73+
74+
For each parent issue that is 100% complete:
75+
76+
1. **Close the issue** using the `update_issue` safe output tool
77+
2. **Add a comment** explaining the closure using the `add_comment` safe output tool
78+
79+
Example comment body:
80+
```
81+
🎉 **Automatically closed by Sub-Issue Closer**
82+
83+
All sub-issues have been completed. This parent issue is now closed automatically.
84+
85+
**Sub-issues status:** X/X closed (100%)
86+
```
87+
88+
### Step 5: Report Summary
89+
90+
At the end of processing, provide a summary of:
91+
- Total parent issues analyzed
92+
- Issues closed in this run
93+
- Issues that remain open (with reason: incomplete sub-issues)
94+
- Any errors or issues that couldn't be processed
95+
96+
## Constraints
97+
98+
- Maximum 20 issues closed per run (configured in safe-outputs)
99+
- Maximum 20 comments added per run
100+
- Only close issues when you are ABSOLUTELY certain all sub-issues are closed
101+
- Skip issues that don't have sub-issues
102+
- Only process open parent issues
103+
- Be conservative: when in doubt, don't close
104+
105+
## Example Output Format
106+
107+
During processing, maintain clear logging:
108+
109+
```
110+
🔍 Analyzing parent issues...
111+
112+
📋 Issue #42: "Feature: Add dark mode"
113+
State: OPEN
114+
Sub-issues: 5 total
115+
- #43: "Design dark mode colors" [CLOSED]
116+
- #44: "Implement dark mode toggle" [CLOSED]
117+
- #45: "Add dark mode to settings" [CLOSED]
118+
- #46: "Test dark mode" [CLOSED]
119+
- #47: "Document dark mode" [CLOSED]
120+
Status: 5/5 closed (100%)
121+
✅ All sub-issues complete - CLOSING
122+
123+
📋 Issue #50: "Feature: User authentication"
124+
State: OPEN
125+
Sub-issues: 3 total
126+
- #51: "Add login page" [CLOSED]
127+
- #52: "Add logout functionality" [OPEN]
128+
- #53: "Add password reset" [CLOSED]
129+
Status: 2/3 closed (67%)
130+
⏸️ Incomplete - keeping open
131+
132+
✅ Summary:
133+
- Parent issues analyzed: 2
134+
- Issues closed: 1
135+
- Issues remaining open: 1
136+
```
137+
138+
## Important Notes
139+
140+
- This is a scheduled workflow that runs daily
141+
- Use the GitHub tools to query issues and their relationships
142+
- Be careful with recursive processing to avoid infinite loops
143+
- Always verify the completion status before closing an issue
144+
- Add clear, informative comments when closing issues for transparency

0 commit comments

Comments
 (0)