Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
sgliner-ledger committed Aug 31, 2023
1 parent 28f3012 commit d276bc1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/check_outdated_build_db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 29 additions & 0 deletions scripts/output_scripts/merge.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit d276bc1

Please sign in to comment.