diff --git a/.github/scripts/announce_pr_on_slack.py b/.github/scripts/announce_pr_on_slack.py index 71ae75f2..8745988b 100644 --- a/.github/scripts/announce_pr_on_slack.py +++ b/.github/scripts/announce_pr_on_slack.py @@ -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() -> ( @@ -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) diff --git a/.github/scripts/announce_release_on_slack.py b/.github/scripts/announce_release_on_slack.py index a54ac6de..5d97cb5a 100755 --- a/.github/scripts/announce_release_on_slack.py +++ b/.github/scripts/announce_release_on_slack.py @@ -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" ) diff --git a/.github/workflows/opened-pr-notification-on-slack.yml b/.github/workflows/opened-pr-notification-on-slack.yml index 33b23d7f..c4723e2d 100644 --- a/.github/workflows/opened-pr-notification-on-slack.yml +++ b/.github/workflows/opened-pr-notification-on-slack.yml @@ -6,7 +6,7 @@ permissions: on: pull_request: - types: [opened, reopened, review_requested] + types: [opened, reopened] jobs: notify-slack: