Skip to content

Commit

Permalink
add a dry-run to auditupdate CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
reneme committed Jul 22, 2024
1 parent 5eeb541 commit 206d57a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/auditupdate/auditupdate/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ def main():
parser.add_argument('-n', '--output-topic-title',
help='Title of the topic to append unreferenced patches to',
default='Uncategorized Patches')
parser.add_argument('-d', '--dry-run',
help='Do not commit or push changes to the repository',
default=False, action='store_true')
parser.add_argument('audit_config_dir',
help='the audit directory to be updated')

Expand Down Expand Up @@ -130,6 +133,10 @@ def main():
logging.critical(f"Upstream repo was updated (from {old_target[0:7]} to {new_target[0:7]}) but didn't find new patches. Something is wrong here!")
return 1

if args.dry_run:
logging.info(f"DRY-RUN: Not committing or pushing changes to the repository.")
return 0

# Commit and push the new (uncategorized) patch references.
run_git(["add", audit.get_topic_file_path(args.output_topic)])
run_git(["commit", "--no-gpg-sign", "-m", f"Automatic update to match patches until {new_target[0:7]}"])
Expand Down

0 comments on commit 206d57a

Please sign in to comment.