diff --git a/.github/workflows/notify/notify-slack.py b/.github/workflows/notify/notify-slack.py index 5c99eee75..97f76b606 100755 --- a/.github/workflows/notify/notify-slack.py +++ b/.github/workflows/notify/notify-slack.py @@ -14,6 +14,7 @@ Manual Environment Variables (explicit): - SLACK_WEBHOOK_URL: incoming webhook URL to send payload/message to - JOB_STATUS: status from GitHub's ``job.status`` - JOB_TITLE: the title of the job +- JOB_KIND: kind of job to notify about, by default "deployment" Global GitHub Environment Variables (implicit): - GITHUB_RUN_ID @@ -57,6 +58,9 @@ class JobNotifier: # Job Status (success|failure|cancelled) self.job_status: str = os.environ["JOB_STATUS"] + # The kind of job (deployment, release tests, ...) + self.job_kind: str = os.getenv("JOB_KIND", "deployment") + @property def run_permalink(self) -> str: """Permalink to the current run logs""" @@ -71,7 +75,7 @@ class JobNotifier: status = self.job_status.capitalize() # Dev deployment triggered by JohnDoe: Success text = ( - f"{self.author} deployment finished for '{self.deployment_kind.capitalize()}', result: " + f"{self.author} {self.job_kind} finished for '{self.deployment_kind.capitalize()}', result: " f"{status}" ) message_data = { diff --git a/.github/workflows/tests-nightly.yml b/.github/workflows/tests-nightly.yml index 9e8889054..921519181 100644 --- a/.github/workflows/tests-nightly.yml +++ b/.github/workflows/tests-nightly.yml @@ -286,3 +286,14 @@ jobs: --pull_request_number $pull_request_number \ --dashboard_url $dashboard_url \ $auto_release + + - name: Notify Slack + if: ${{ failure() && github.event_name == 'repository_dispatch'}} + env: + JOB_DEPLOYMENT_KIND: staging + JOB_STATUS: ${{ job.status }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_RELEASES_WEBHOOK_URL }} + JOB_TITLE: "Test release workflow - ${{github.event.client_payload.project}} ${{github.event.client_payload.version}}" + JOB_KIND: "release tests" + run: | + python3 ./.github/workflows/notify/notify-slack.py \ No newline at end of file