diff --git a/.github/management_bot/pulumi/src/issues/handler.py b/.github/management_bot/pulumi/src/issues/handler.py index f336ff6f..52a7198c 100644 --- a/.github/management_bot/pulumi/src/issues/handler.py +++ b/.github/management_bot/pulumi/src/issues/handler.py @@ -18,7 +18,7 @@ def title_handler(context_dicts: _types.Context, context_objs: _types.Objects) -> list[str]: - if not re.match(r"^(bug|idea|implement|cleanup):\s*\S.*", context_objs.issue.title): + if not re.match(r"^(bug|idea|implement|cleanup):\s*\S.*", context_objs.issue.title) and context_objs.sender.type == "User": logger.info(f"Regex title doesn't match. {context_objs.issue.title} doesnt start with bug|idea|implement|cleanup:") logger.info(f"Commenting on {context_objs.issue.html_url}") context_objs.issue.create_comment( @@ -42,7 +42,7 @@ def title_handler(context_dicts: _types.Context, context_objs: _types.Objects) - def delete_reply_handler(context_dicts: _types.Context, context_objs: _types.Objects) -> list[str]: match = re.search(r"DELREPLY-(.{8})", context_dicts.comment.body) - if not match: + if not match or context_objs.sender.type != "User": return [] logger.info("Deleting comment due to DELREPLY in body") diff --git a/.github/management_bot/pulumi/src/lambda_handler.py b/.github/management_bot/pulumi/src/lambda_handler.py index 6d5133b2..3d2f1032 100644 --- a/.github/management_bot/pulumi/src/lambda_handler.py +++ b/.github/management_bot/pulumi/src/lambda_handler.py @@ -57,9 +57,8 @@ def is_trey(sender): def lambda_handler(event: dict, lambda_context): - print(lambda_context) # https://docs.aws.amazon.com/systems-manager/latest/userguide/ps-integration-lambda-extensions.html - stage = "production" + stage = "staging" if lambda_context.function_version == "$LATEST" else "production" req = urllib.request.Request( f"http://localhost:2773/systemsmanager/parameters/get?withDecryption=true&name=%2Fmyfinances%2Fgithub_bot%2F{stage}" ) @@ -106,4 +105,6 @@ def lambda_handler(event: dict, lambda_context): else: logger.debug("Using no handler; invalid request.") + logger.info("Actions taken: %s", actions_taken) + return {"statusCode": 200, "body": json.dumps({"actions_taken": actions_taken}), "headers": {"Content-Type": "application/json"}}