Skip to content

Commit

Permalink
Update send_slack_notification.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielraeder committed Apr 11, 2024
1 parent 5eae31b commit 8976f6c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions send_slack_notification.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import requests
import os
import sys


def send_slack_notification(message, assignee, origin_repo, webhook_url):
print(assignee)
def send_slack_notification(message, assignee, origin_repo):
webhook_url = os.environ.get("SLACK_WEBHOOK_URL")
if webhook_url is None:
print("SLACK_WEBHOOK_URL environment variable is not set.")
sys.exit(1)
data = {"Message": message, "Assignee": assignee, "Origin_Repo": origin_repo}
print(data)
response = requests.post(webhook_url, json=data)
Expand All @@ -21,7 +25,4 @@ def send_slack_notification(message, assignee, origin_repo, webhook_url):
message = sys.argv[1]
assignee = sys.argv[2]
origin_repo = sys.argv[3]
webhook_url = sys.argv[
4
] # Assuming the webhook URL is passed as a command-line argument
send_slack_notification(message, assignee, origin_repo, webhook_url)
send_slack_notification(message, assignee, origin_repo)

0 comments on commit 8976f6c

Please sign in to comment.