Skip to content

Fix Slack GH Actions #776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions .github/scripts/announce_pr_on_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,20 @@ def send_slack_message(

data = {"text": message}

try:
with httpx.Client() as client:
response = client.post(url, headers=headers, json=data)
response.raise_for_status()
ret = False
with httpx.Client() as client:
response = client.post(url, headers=headers, json=data)
response.raise_for_status()

result = response.text
if "ok" in result:
print("✅ Slack message sent successfully")
return True
else:
print(f"❌ Slack API error: {result}")
return False
result = response.text
if "ok" in result:
print("✅ Slack message sent successfully")
ret = True
else:
print(f"❌ Slack API error: {result}")
ret = False

except httpx.HTTPError as e:
print(f"❌ Request error: {e}")
return False
return ret


def ensure_environment_variables_are_present() -> (
Expand Down Expand Up @@ -139,7 +137,7 @@ def main() -> None:
)

# Send to Slack
success = send_slack_message(slack_service, slack_team, slack_token, message)
success = send_slack_message(slack_team, slack_service, slack_token, message)

if not success:
sys.exit(1)
Expand Down
9 changes: 4 additions & 5 deletions .github/scripts/announce_release_on_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ def get_gh_release_info_text_with_token(release_tag: str, access_token: str) ->

msg = (
f":mega: Oyez! Oyez! Oyez!\n"
f":package: A new version of the Python Tracer has been released.\n"
f"Name: Instana Python Tracer {release.title}\n"
f"Tag: {release.tag_name}\n"
f"Created at: {release.created_at}\n"
f"Published at: {release.published_at}\n"
f"The Instana Python Tracer {release_tag} has been released.\n"
f":package: https://pypi.org/project/instana/ \n"
f":github: {release.html_url} \n"
f"**Release Notes:**\n"
f"{release.body}\n"
)

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/opened-pr-notification-on-slack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ permissions:

on:
pull_request:
types: [opened, reopened, review_requested]
types: [opened, reopened]

jobs:
notify-slack:
Expand Down
Loading