Skip to content

Commit ec9be1c

Browse files
pvitalGSVarsha
authored andcommitted
fix(ci): Arguments sequence to send Slack announcement.
Signed-off-by: Paulo Vital <[email protected]>
1 parent b302623 commit ec9be1c

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

.github/scripts/announce_pr_on_slack.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,20 @@ def send_slack_message(
2525

2626
data = {"text": message}
2727

28-
try:
29-
with httpx.Client() as client:
30-
response = client.post(url, headers=headers, json=data)
31-
response.raise_for_status()
28+
ret = False
29+
with httpx.Client() as client:
30+
response = client.post(url, headers=headers, json=data)
31+
response.raise_for_status()
3232

33-
result = response.text
34-
if "ok" in result:
35-
print("✅ Slack message sent successfully")
36-
return True
37-
else:
38-
print(f"❌ Slack API error: {result}")
39-
return False
33+
result = response.text
34+
if "ok" in result:
35+
print("✅ Slack message sent successfully")
36+
ret = True
37+
else:
38+
print(f"❌ Slack API error: {result}")
39+
ret = False
4040

41-
except httpx.HTTPError as e:
42-
print(f"❌ Request error: {e}")
43-
return False
41+
return ret
4442

4543

4644
def ensure_environment_variables_are_present() -> (
@@ -139,7 +137,7 @@ def main() -> None:
139137
)
140138

141139
# Send to Slack
142-
success = send_slack_message(slack_service, slack_team, slack_token, message)
140+
success = send_slack_message(slack_team, slack_service, slack_token, message)
143141

144142
if not success:
145143
sys.exit(1)

.github/workflows/opened-pr-notification-on-slack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permissions:
66

77
on:
88
pull_request:
9-
types: [opened, reopened, review_requested]
9+
types: [opened, reopened]
1010

1111
jobs:
1212
notify-slack:

0 commit comments

Comments
 (0)