Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Trey <[email protected]>
  • Loading branch information
TreyWW committed Jul 15, 2024
1 parent 36c3c60 commit d7ac271
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/management_bot/pulumi/src/issues/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions .github/management_bot/pulumi/src/lambda_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
)
Expand Down Expand Up @@ -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"}}

0 comments on commit d7ac271

Please sign in to comment.