Skip to content

Commit

Permalink
fix: Do not update files when there are no updates
Browse files Browse the repository at this point in the history
  • Loading branch information
fukusuket committed Oct 15, 2024
1 parent 51a514d commit 99d0efd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion doc/SupportedSigmaFieldModifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
| utf16ǀbase64offsetǀcontains | 0 | 0 |
| wideǀbase64offsetǀcontains | 0 | 0 |

Updated: 2024/10/15
This document is being dynamically updated based on the latest rules.
Last Update: 2024/10/16
Author: Fukusuke Takahashi
5 changes: 3 additions & 2 deletions scripts/supported_modifiers_check/supported-modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ def get_yml_detection_counts(dir_path: str) -> Counter:
markdown_str = markdown_str + pd.DataFrame(sorted(result_supported), columns=header).to_markdown(index=False)
markdown_str = markdown_str + "\n\n# Hayabusa unsupported field modifiers\n"
markdown_str = markdown_str + pd.DataFrame(sorted(result_unsupported), columns=header).to_markdown(index=False)
markdown_str = markdown_str + "\n\nThis document is being dynamically updated based on the latest rules."
current_markdown = Path(args.out_path)
if current_markdown.exists():
current_str = current_markdown.read_text(encoding='utf-8')
current_str = re.sub(r"This document is being dynamically updated based on the latest rules. Last Update:.*", "", current_str, flags=re.DOTALL).strip()
current_str = re.sub(r"Last Update:.*", "", current_str, flags=re.DOTALL).strip()
if current_str == markdown_str.strip():
logging.info("No changes detected in the report. Skipping file write.")
else:
markdown_str = f"{markdown_str}\n\nUpdated: {datetime.datetime.now().strftime('%Y/%m/%d')} \nAuthor: Fukusuke Takahashi"
markdown_str = f"{markdown_str}\nLast Update: {datetime.datetime.now().strftime('%Y/%m/%d')}\nAuthor: Fukusuke Takahashi"
Path(args.out_path).write_text(markdown_str)
logging.info(f'Markdown report generated and saved to {args.out_path}')
end_time = time.time()
Expand Down

0 comments on commit 99d0efd

Please sign in to comment.