From a88fbe379c674d74a479cb91b4067045e83eb0cc Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 26 Sep 2024 18:41:29 +0000 Subject: [PATCH] Filter more messages, disallow new lines --- main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 6eff28f..64c2fe0 100644 --- a/main.py +++ b/main.py @@ -46,7 +46,7 @@ Write a ONE LINE git commit message for the following diff. Respond with only the commit message. Do not include quotes. Do not include file extensions. -DO NOT just say "Update notes", "Add new notes", "Refactor notes". +DO NOT just say "Update notes", "Add new notes", "Refactor notes", "Make documentation updates". Tersely summarize how each note changed. Write in imperitive tense. \n\n==============\n\n''' @@ -67,6 +67,9 @@ Write in imperitive tense. elif 'notes/' in message.lower(): logging.info(' Message contains notes directory, aborting') return False + elif '\n' in message: + logging.info(' Message contains new lines, aborting') + return False return message @@ -89,7 +92,10 @@ def main(): logging.info('Unable to generate acceptable message, exiting.') exit(1) - git_commit(message) + if DEBUG: + logging.info('Running in debug, not actually committing.') + else: + git_commit(message) if __name__ == '__main__':