Skip to content

Commit

Permalink
Clean json files after running
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx committed Nov 27, 2023
1 parent 3d0e86a commit 94cd8bd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/scripts/check_lineage_updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ current_branch=$(git rev-parse --abbrev-ref HEAD)
# run cleanup on exit
function cleanup {
git checkout $current_branch
./report_pr_changes --branch old --computation clean
}
trap cleanup EXIT

Expand Down
20 changes: 20 additions & 0 deletions bin/report_pr_changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Example:
report_pr_changes branch_a branch_b
"""
import os
import argparse
import json

Expand Down Expand Up @@ -167,6 +168,22 @@ def report_changes():
print("\n")


def clean():
for filename in [
version_hash_dict_old_name,
version_hash_dict_new_name,
plugin_update_comparison_name,
new_changed_plugin_bad_info_name,
new_affected_plugin_bad_info_name,
old_changed_plugin_bad_info_name,
old_affected_plugin_bad_info_name,
]:
try:
os.remove(filename)
except OSError:
pass


if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Check results changes induced by PR")
parser.add_argument(
Expand All @@ -186,6 +203,7 @@ if __name__ == "__main__":
"print_added_plugin",
"changed_affected_plugin",
"report_changes",
"clean",
],
help="Type of computation",
)
Expand All @@ -201,3 +219,5 @@ if __name__ == "__main__":
get_changed_affected_plugin_info()
elif args.computation == "report_changes":
report_changes()
elif args.computation == "clean":
clean()

0 comments on commit 94cd8bd

Please sign in to comment.