Automating Estimate Roll-ups in GitHub Projects: A Key for Development KPI Examples
GitHub Projects have become an indispensable tool for many development teams, offering robust features for tracking initiatives and breaking down work into manageable sub-issues. However, a common challenge arises when teams want to aggregate custom data, such as "Estimates" or "Story Points," from these sub-issues directly into their parent issues. Manually calculating these sums can quickly become a bottleneck, leading to outdated data and hindering accurate project oversight.
The Challenge: Rolling Up Custom Fields in GitHub Projects
A recent discussion on the GitHub Community forum highlighted this exact pain point. A user, shamszia750-lab, shared their team's heavy reliance on GitHub Projects and sub-issues, along with a custom "Estimate" number field. Their core question: Is there a native way to automatically sum these estimate values from sub-issues into the parent issue? The current manual process was proving unsustainable, especially as project scopes evolve and new sub-issues are added.
GitHub's Current Limitations and the API-Driven Solution
As confirmed by shamas202 in the discussion, there is currently no native, built-in feature within GitHub Projects to automatically sum custom number fields from sub-issues to their parent. While GitHub's native sub-issue functionality tracks overall progress (e.g., how many sub-issues are closed), it doesn't extend to aggregating custom data. This is a crucial distinction for teams looking to track specific development KPI examples like total estimated effort for a larger epic.
However, the good news is that GitHub Projects are deeply integrated with GitHub's powerful API. This API-driven nature opens the door for custom automation using GitHub Actions and GraphQL queries – a standard and highly effective workaround.
The GitHub Actions Workaround Explained
The recommended solution involves creating a GitHub Actions workflow that triggers whenever an issue is opened, edited, closed, or even deleted. This workflow would perform the following steps:
- Trigger: Listen for changes to issues within your project.
- Identify Parent: Check if the modified issue is a sub-issue and has a parent.
- Query Sub-issues: Use the GraphQL API to fetch all sub-issues associated with that identified parent.
- Sum Custom Field: Iterate through these sub-issues and sum the values of the specific custom field (e.g., "Estimate").
- Update Parent: Use a GraphQL mutation to update the parent issue's corresponding custom field with the newly calculated total.
This automated approach ensures that your parent issues always reflect the most up-to-date aggregate estimates from their sub-issues, providing accurate data for your project tracking and development KPI examples without manual intervention.
Conceptual Workflow Example
While specific custom field IDs vary between organizations, the core logic for such a workflow typically leverages the actions/github-script action to execute custom JavaScript code that interacts with the GraphQL API. Here's a conceptual skeleton provided in the discussion, illustrating how your .github/workflows/estimate-rollup.yml might look:
name: Rollup Sub-issue Estimates
on:
issues:
types: [opened, edited, closed, deleted]
jobs:
rollup-estimates:
runs-on: ubuntu-latest
steps:
- name: Calculate and Update Parent Estimate
uses: actions/github-script@v7
with:
github-token: ${{ secrets.PROJECT_PAT }}
script: |
// 1. Check if the current issue has a parent.
// 2. Fetch all sub-issues for that parent via the GraphQL API.
// 3. Sum the specific Custom Field (e.g., 'Estimate').
// 4. Update the Parent Issue's Custom Field via GraphQL mutation.
console.log("Insert GraphQL query/mutation logic here to sum estimates.");
Implementing this requires familiarity with GitHub Actions, GraphQL, and your specific project's custom field IDs. However, once set up, it dramatically improves the accuracy and efficiency of tracking estimated effort across your project hierarchy, making it a valuable addition to any developer software toolkit.
Conclusion
The ability to automatically roll up custom field values in GitHub Projects is a highly sought-after feature that, while not native, is entirely achievable through the powerful combination of GitHub Actions and the GraphQL API. By automating this process, teams can eliminate manual errors, ensure data consistency, and gain clearer insights into their project's progress and overall effort, significantly enhancing their ability to track and analyze key development KPI examples.
