From 952b69cf0e26f96dad8327ca79eaa6d9ddcb8123 Mon Sep 17 00:00:00 2001 From: Paulo Vital Date: Fri, 8 Aug 2025 15:44:17 +0200 Subject: [PATCH 1/2] chore(ci): Enhance the release announcement message. Signed-off-by: Paulo Vital --- .github/scripts/announce_release_on_slack.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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" ) From 8e1b26c77dfe5f41a40fbc22578224432d20f176 Mon Sep 17 00:00:00 2001 From: Paulo Vital Date: Fri, 8 Aug 2025 15:47:35 +0200 Subject: [PATCH 2/2] fix(ci): Arguments sequence to send Slack announcement. Signed-off-by: Paulo Vital --- .github/scripts/announce_pr_on_slack.py | 28 +++++++++---------- .../opened-pr-notification-on-slack.yml | 2 +- 2 files changed, 14 insertions(+), 16 deletions(-) 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/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: