* Fix Release Progress badges and workflow

- Fix update-progress.py to output blocker/mustdo counts in correct format
  The workflow expects blocker_done=, blocker_total=, mustdo_done=, mustdo_total=
  output lines but the script was only outputting human-readable format

- Update README badge links to point to project view 24 instead of base project

This fixes the workflow failures where BLOCKER_DONE and the related environment
variables were not being set, causing badge updates to fail.

The badges were pointing to old unmaintained gists under user X.
Updated to use the gist automatically maintained by the Release Progress
workflow (gist ID: 0ad2eabb63b28eb90d69f5e5b2c1496f).

The workflow now successfully updates these badges every 4 hours with
current release blocker and must-do progress.

The script now auto-detects the HDF5 version from src/H5public.h and
filters release blockers/must-do items by milestone matching that version.

Changes:
- Added get_hdf5_version_from_header() to read version from H5public.h
- Updated GraphQL query to fetch milestone information from issues
- Added milestone filtering logic to only count items for the target release
- Made validation more lenient when using milestone filter (allows 0/0)
- Added MILESTONE_FILTER environment variable for manual override

For develop branch with version 2.1.0 in H5public.h, this will now only
count items with milestone containing "2.1" (e.g., "2.1.0", "HDF5 2.1").

* Add version number to badge labels

The badges now display the version (e.g., "2.1 Release Blockers" instead
of just "Release Blockers") when filtering by milestone.

Changes:
- Python script outputs version to GitHub Actions
- Workflow passes version to badge generation script
- Badge script includes version in label if available
- Labels show "X.Y Release Blockers" / "X.Y Release Must Do"


The three badges now track:
1. Release Blockers - Critical issues that must be resolved
2. Release Must Do - Important items for the release
3. Release Nice to Have - Optional improvements for the release

All three badges show version prefix (e.g., "2.1") and support 0/0
display when no items exist for a milestone.

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Scot Breitenfeld
2026-01-22 14:37:45 -06:00
committed by GitHub
co-authored by Claude Sonnet 4.5
parent 17a847faf9
commit 16364fe2fa
4 changed files with 210 additions and 35 deletions
+109 -17
View File
@@ -28,15 +28,20 @@ FIELD_STATUS = "Status"
# Expected values for Release gating field
VALUE_RELEASE_BLOCKER = "Release_Blocker"
VALUE_RELEASE_MUST_DO = "Release_Must Do"
VALUE_RELEASE_NICE_TO_HAVE = "Release_Nice to Have"
# Expected value for Status field when an item is completed
VALUE_STATUS_DONE = "Done"
# Milestone filtering
# Set to None to include all milestones, or specify a version like "2.1" to filter
DEFAULT_MILESTONE_FILTER = None # Will be set from environment or H5public.h
class GitHubProjectTracker:
"""Tracks release blocker progress in GitHub projects."""
def __init__(self, token: str, owner: str, project_number: int):
def __init__(self, token: str, owner: str, project_number: int, milestone_filter: Optional[str] = None):
self.api_url = "https://api.github.com/graphql"
self.headers = {
"Authorization": f"bearer {token}",
@@ -44,6 +49,7 @@ class GitHubProjectTracker:
}
self.owner = owner
self.project_number = project_number
self.milestone_filter = milestone_filter
def _get_query(self) -> str:
"""Returns the GraphQL query for fetching project items."""
@@ -75,7 +81,12 @@ class GitHubProjectTracker:
}
}
}
content { ... on Issue { id, title, url } }
content {
... on Issue {
id, title, url
milestone { title }
}
}
}
}
}
@@ -115,16 +126,18 @@ class GitHubProjectTracker:
def fetch_release_blocker_stats(self) -> Dict[str, int]:
"""
Fetches release blocker and must-do statistics from the GitHub project.
Fetches release blocker, must-do, and nice-to-have statistics from the GitHub project.
Returns:
Dict with 'total', 'done', 'percentage', 'blocker_total', 'blocker_done',
'mustdo_total', 'mustdo_done' keys
'mustdo_total', 'mustdo_done', 'nicetohave_total', 'nicetohave_done' keys
"""
blocker_total = 0
blocker_done = 0
mustdo_total = 0
mustdo_done = 0
nicetohave_total = 0
nicetohave_done = 0
cursor = None
# Track if we've seen the expected fields at least once
@@ -162,6 +175,17 @@ class GitHubProjectTracker:
if not item.get("content"):
continue
# Check milestone filter if configured
content = item.get("content", {})
milestone = content.get("milestone", {})
milestone_title = milestone.get("title", "") if milestone else ""
# Skip if milestone filter is set and doesn't match
if self.milestone_filter:
# Match milestone versions like "2.1" with milestones like "2.1.0" or "HDF5 2.1"
if not (milestone_title and self.milestone_filter in milestone_title):
continue
fields = self._parse_item_fields(item)
# Validate expected fields exist
@@ -181,6 +205,10 @@ class GitHubProjectTracker:
mustdo_total += 1
if status == VALUE_STATUS_DONE:
mustdo_done += 1
elif release_gating == VALUE_RELEASE_NICE_TO_HAVE:
nicetohave_total += 1
if status == VALUE_STATUS_DONE:
nicetohave_done += 1
# Check for next page
page_info = items.get("pageInfo", {})
@@ -219,16 +247,22 @@ class GitHubProjectTracker:
# Validate that we found at least some items
# If total is 0, either the project is empty or field matching failed
if total == 0:
print("ERROR: No release blocker or must-do items found (total=0).", file=sys.stderr)
print("This likely indicates:", file=sys.stderr)
print(f" 1. The '{FIELD_RELEASE_GATING}' field values changed", file=sys.stderr)
print(f" Expected values: '{VALUE_RELEASE_BLOCKER}' or '{VALUE_RELEASE_MUST_DO}'", file=sys.stderr)
print(" 2. Project has no items with these field values", file=sys.stderr)
print(" 3. Field matching logic needs to be updated", file=sys.stderr)
print("Refusing to report 0% or 100% with no items to prevent false positives.", file=sys.stderr)
raise ProjectDataError("No release items found - refusing to report false completion status")
percentage = round((done / total * 100), 1)
if self.milestone_filter:
print(f"INFO: No release blocker or must-do items found for milestone '{self.milestone_filter}'.", file=sys.stderr)
print("This may be expected if no items exist for this milestone yet.", file=sys.stderr)
# Don't fail - return N/A indicators when filtering by milestone with no items
percentage = -1.0 # Use -1 to indicate N/A
else:
print("ERROR: No release blocker or must-do items found (total=0).", file=sys.stderr)
print("This likely indicates:", file=sys.stderr)
print(f" 1. The '{FIELD_RELEASE_GATING}' field values changed", file=sys.stderr)
print(f" Expected values: '{VALUE_RELEASE_BLOCKER}' or '{VALUE_RELEASE_MUST_DO}'", file=sys.stderr)
print(" 2. Project has no items with these field values", file=sys.stderr)
print(" 3. Field matching logic needs to be updated", file=sys.stderr)
print("Refusing to report 0% or 100% with no items to prevent false positives.", file=sys.stderr)
raise ProjectDataError("No release items found - refusing to report false completion status")
else:
percentage = round((done / total * 100), 1)
return {
'total': total,
@@ -237,19 +271,68 @@ class GitHubProjectTracker:
'blocker_total': blocker_total,
'blocker_done': blocker_done,
'mustdo_total': mustdo_total,
'mustdo_done': mustdo_done
'mustdo_done': mustdo_done,
'nicetohave_total': nicetohave_total,
'nicetohave_done': nicetohave_done
}
def get_hdf5_version_from_header(header_path: str = "../../src/H5public.h") -> Optional[str]:
"""
Extract HDF5 major.minor version from H5public.h
Returns version string like "2.1" or None if not found.
"""
try:
# Try multiple possible paths relative to the script location
script_dir = os.path.dirname(os.path.abspath(__file__))
possible_paths = [
os.path.join(script_dir, header_path),
os.path.join(script_dir, "../../src/H5public.h"),
"src/H5public.h",
"../../src/H5public.h"
]
for path in possible_paths:
if os.path.exists(path):
with open(path, 'r') as f:
major = None
minor = None
for line in f:
if '#define H5_VERS_MAJOR' in line:
major = line.split()[-1]
elif '#define H5_VERS_MINOR' in line:
minor = line.split()[-1]
if major and minor:
return f"{major}.{minor}"
break
except Exception as e:
print(f"Warning: Could not read version from H5public.h: {e}", file=sys.stderr)
return None
def main():
"""Main function to run the tracker."""
# Configuration - can be overridden by environment variables
TOKEN = os.getenv("GITHUB_TOKEN")
OWNER = os.getenv("GITHUB_OWNER", "HDFGroup")
PROJECT_NUMBER = int(os.getenv("GITHUB_PROJECT_NUMBER", "39"))
# Milestone filtering - can be set via env var or auto-detected from H5public.h
MILESTONE_FILTER = os.getenv("MILESTONE_FILTER")
if MILESTONE_FILTER is None:
# Try to auto-detect from H5public.h
MILESTONE_FILTER = get_hdf5_version_from_header()
if MILESTONE_FILTER:
print(f"Auto-detected milestone filter from H5public.h: {MILESTONE_FILTER}", file=sys.stderr)
if MILESTONE_FILTER:
print(f"Filtering by milestone: {MILESTONE_FILTER}", file=sys.stderr)
else:
print("No milestone filter - counting all release items", file=sys.stderr)
try:
tracker = GitHubProjectTracker(TOKEN, OWNER, PROJECT_NUMBER)
tracker = GitHubProjectTracker(TOKEN, OWNER, PROJECT_NUMBER, MILESTONE_FILTER)
stats = tracker.fetch_release_blocker_stats()
# Output for GitHub Actions
@@ -263,6 +346,9 @@ def main():
f.write(f"blocker_done={stats['blocker_done']}\n")
f.write(f"mustdo_total={stats['mustdo_total']}\n")
f.write(f"mustdo_done={stats['mustdo_done']}\n")
f.write(f"nicetohave_total={stats['nicetohave_total']}\n")
f.write(f"nicetohave_done={stats['nicetohave_done']}\n")
f.write(f"version={MILESTONE_FILTER or 'all'}\n")
# Also output to stdout for local testing
print(f"percentage={stats['percentage']}")
@@ -270,10 +356,16 @@ def main():
print(f"blocker_total={stats['blocker_total']}")
print(f"mustdo_done={stats['mustdo_done']}")
print(f"mustdo_total={stats['mustdo_total']}")
print(f"nicetohave_done={stats['nicetohave_done']}")
print(f"nicetohave_total={stats['nicetohave_total']}")
print(f"version={MILESTONE_FILTER or 'all'}")
print(f"Calculated progress: {stats['percentage']}%")
print(f"Done / Total: {stats['done']} / {stats['total']}")
print(f"Blockers: {stats['blocker_done']} / {stats['blocker_total']}")
print(f"Must Do: {stats['mustdo_done']} / {stats['mustdo_total']}")
print(f"Nice to Have: {stats['nicetohave_done']} / {stats['nicetohave_total']}")
if MILESTONE_FILTER:
print(f"Milestone filter: {MILESTONE_FILTER}")
except Exception as e:
print(f"Error: {e}", file=sys.stderr)