mumrah commented on code in PR #17124: URL: https://github.com/apache/kafka/pull/17124#discussion_r1752369135
########## committer-tools/refresh_collaborators.py: ########## @@ -0,0 +1,143 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +""" +This script automates the process of fetching contributor data from GitHub +repositories, filtering top contributors who are not part of the existing +committers, and updating a local configuration file (.asf.yaml) to include these +new contributors. +""" + +import io +import logging +import os +from datetime import datetime, timedelta +from typing import Dict, List, Tuple + +from bs4 import BeautifulSoup +from github import Github +from github.Commit import Commit +from github.ContentFile import ContentFile +from github.PaginatedList import PaginatedList +from github.Repository import Repository +from ruamel.yaml import YAML + +logging.basicConfig( + format='{"timestamp":"%(asctime)s","level":"%(levelname)s","message":"%(message)s"}', Review Comment: Since this script is for humans, lets not use JSON here. Just `%(asctime)s %(levelname)s %(message)s` is fine ########## committer-tools/README.md: ########## @@ -0,0 +1,67 @@ +# GitHub Contributor Automator + +The Refresh Collaborators script automates the process of fetching contributor +data from GitHub repositories, filtering top contributors who are not part of +the existing committers, and updating a local configuration file (.asf.yaml) to +include these new contributors. + +## Table of Contents + +- [Requirements](#requirements) +- [Installation](#installation) +- [Usage](#usage) + +## Requirements + +- Python 3.x and pip +- A valid GitHub token with repository read access + +## Installation + +### 1. Check Python installation + +Check if Python and pip are installed in your system. + +```bash +python3 --version +pip3 --version +``` + +### 2. Set up a virtual environment (optional) + +```bash +python3 -m venv venv + + # For Linux/macOS +source venv/bin/activate + +# On Windows: +# .\venv\Scripts\activate +``` + +3. Install the required dependencies + +```bash +pip3 install -r requirements.txt +``` + +## Usage + +### 1. Set up the environment variable for GitHub Token + +You need to set up a valid GitHub token to access the repository. After you +generate it, this can be done by setting the GITHUB_TOKEN environment variable. Review Comment: Is it possible to get a token using the `gh` CLI? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
