Update the governance file with the latest committer information.
(file_path: str)
| 145 | |
| 146 | |
| 147 | def update_governance_file(file_path: str): |
| 148 | """Update the governance file with the latest committer information.""" |
| 149 | try: |
| 150 | with open(file_path, 'r') as f: |
| 151 | content = f.read() |
| 152 | except FileNotFoundError: |
| 153 | print(f"Error: File {file_path} not found") |
| 154 | return False |
| 155 | |
| 156 | # Parse existing committers |
| 157 | existing_committers = parse_existing_table(content) |
| 158 | print(f"Found {len(existing_committers)} existing committers") |
| 159 | |
| 160 | # Get ASF roster |
| 161 | asf_pmcs, asf_committers = get_asf_roster() |
| 162 | print(f"Found {len(asf_pmcs)} PMCs and {len(asf_committers)} committers in ASF roster") |
| 163 | |
| 164 | |
| 165 | # Create a map of existing committers by apache id |
| 166 | existing_by_apache = {c.apache: c for c in existing_committers} |
| 167 | |
| 168 | # Update the entries based on the ASF roster |
| 169 | updated_committers = [] |
| 170 | for apache_id, name in {**asf_pmcs, **asf_committers}.items(): |
| 171 | role = 'PMC' if apache_id in asf_pmcs else 'Committer' |
| 172 | if apache_id in existing_by_apache: |
| 173 | existing = existing_by_apache[apache_id] |
| 174 | # Preserve PMC Chair role if already set |
| 175 | if existing.role == 'PMC Chair': |
| 176 | role = 'PMC Chair' |
| 177 | updated_committers.append(Committer( |
| 178 | name=existing.name, |
| 179 | apache=apache_id, |
| 180 | github=existing.github, |
| 181 | affiliation=existing.affiliation, |
| 182 | role=role |
| 183 | )) |
| 184 | # add a new entry for new committers with placeholder values |
| 185 | else: |
| 186 | print(f"New entry found: {name} ({apache_id})") |
| 187 | # Placeholder github and affiliation |
| 188 | updated_committers.append(Committer( |
| 189 | name=name, |
| 190 | apache=apache_id, |
| 191 | github="", # user should update |
| 192 | affiliation="", # User should update |
| 193 | role=role |
| 194 | )) |
| 195 | |
| 196 | |
| 197 | # Sort the committers |
| 198 | sorted_committers = sort_committers(updated_committers) |
| 199 | |
| 200 | # Generate new table |
| 201 | table_lines = [ |
| 202 | "| Name | Apache ID | github | Affiliation | Role |", |
| 203 | "|-------------------------|-----------|----------------------------|-------------|-----------|" |
| 204 | ] |
no test coverage detected
searching dependent graphs…