diff --git a/.github/workflows/check_outdated_build_db.yaml b/.github/workflows/check_outdated_build_db.yaml index 5163c85..54493a1 100644 --- a/.github/workflows/check_outdated_build_db.yaml +++ b/.github/workflows/check_outdated_build_db.yaml @@ -15,7 +15,7 @@ jobs: - name: Build db run: | - python3 scripts/create_app_list/main.py --output_file out.json --access_token ${{ secrets.GH_ACCESS_TOKEN }} + python3 scripts/create_app_list/main.py --full_output_file out.json --access_token ${{ secrets.GH_ACCESS_TOKEN }} - name: Compare Files run: | # Compare two files using diff diff --git a/scripts/output_scripts/merge.py b/scripts/output_scripts/merge.py new file mode 100644 index 0000000..8f863d5 --- /dev/null +++ b/scripts/output_scripts/merge.py @@ -0,0 +1,29 @@ +import argparse +import json + +def merge_json_files(input_files, output_file, merge_key): + merged_data = {} + + for input_file in input_files: + with open(input_file, 'r') as f: + data = json.load(f) + key_value = data.get(merge_key) + if key_value is not None: + merged_data[key_value] = data + + with open(output_file, 'w') as f: + json.dump(merged_data, f, indent=2) + +def main(): + parser = argparse.ArgumentParser(description="Merge JSON files based on a specified key") + parser.add_argument("input_files", nargs="+", help="List of input JSON files") + parser.add_argument("output_file", help="Output merged JSON file") + parser.add_argument("merge_key", help="Key to use for merging") + + args = parser.parse_args() + + merge_json_files(args.input_files, args.output_file, args.merge_key) + print(f"Merged data saved to {args.output_file}") + +if __name__ == "__main__": + main()