eliminates the build commits and merge commits

 avatar
unknown
python
a year ago
576 B
5
Indexable
import json

# Define the input and output file paths
input_file = 'commits.json'
output_file = 'commits-filter.json'

# Read data from input file
with open(input_file, 'r') as f:
    data = json.load(f)

# Filter out objects with specific messages
filtered_data = [commit for commit in data if not any(
    keyword in commit['message'].lower() for keyword in ['dev build', 'merge branch'])]

# Write filtered data to output file
with open(output_file, 'w') as f:
    json.dump(filtered_data, f, indent=2)

print(f"Filtered commits saved to {output_file}")
Editor is loading...
Leave a Comment