diff --git a/.github/workflows/governance-reusable.yml b/.github/workflows/governance-reusable.yml index 880db774..4fcba58c 100644 --- a/.github/workflows/governance-reusable.yml +++ b/.github/workflows/governance-reusable.yml @@ -174,9 +174,18 @@ jobs: exemption_patterns = [] claude_md = pathlib.Path('.claude/CLAUDE.md') if claude_md.exists(): + # Locate the TypeScript-exemption section's heading line. The + # regex matches any markdown heading containing both + # "TypeScript" and "Exemption[s]" — accepts variants like + # "### TypeScript Exemptions (Approved)" and + # "### TypeScript / JavaScript Exemptions (Approved)" — and + # is anchored to a heading prefix so prose mentions of the + # phrase elsewhere in the file (e.g. "the TypeScript + # exemptions above") do NOT trigger table parsing. + ts_heading = re.compile(r'^#{1,4}\s+.*TypeScript.*[Ee]xemption') in_table = False for line in claude_md.read_text(encoding='utf-8').splitlines(): - if re.search(r'TypeScript [Ee]xemptions', line): + if ts_heading.match(line): in_table = True continue if in_table and line.startswith(('### ', '## ', '# ')):