From a9817e1afe8d4f6c42656250c26398535f86ec18 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 18 Apr 2024 09:20:01 -0400 Subject: [PATCH] wip: Add support for sending email on instance created, started or stopped App password created using https://myaccount.google.com/apppasswords --- .github/workflows/control-instance.yml | 28 ++++++++++++++++++++++++++ .github/workflows/create-instance.yml | 14 +++++++++++++ 2 files changed, 42 insertions(+) diff --git a/.github/workflows/control-instance.yml b/.github/workflows/control-instance.yml index eec2e996c..30278d79b 100644 --- a/.github/workflows/control-instance.yml +++ b/.github/workflows/control-instance.yml @@ -20,6 +20,20 @@ jobs: env: NUMBER: ${{ github.event.issue.number }} + - name: Send mail + uses: dawidd6/action-send-mail@2cea9617b09d79a095af21254fbcb7ae95903dde # v3.12.0 + with: + server_address: smtp.gmail.com + server_port: 465 + secure: true + username: ${{secrets.MAIL_USERNAME}} + password: ${{secrets.MAIL_PASSWORD}} + from: MorphoCloudPortal + subject: + "[MorphoCloudPortal] Instance ${{ github.event.issue.number }} + started" + body: Instance ${{ github.event.issue.number }} started + stop: runs-on: self-hosted if: @@ -30,3 +44,17 @@ jobs: echo Stopping instance associated with issue $NUMBER env: NUMBER: ${{ github.event.issue.number }} + + - name: Send mail + uses: dawidd6/action-send-mail@2cea9617b09d79a095af21254fbcb7ae95903dde # v3.12.0 + with: + server_address: smtp.gmail.com + server_port: 465 + secure: true + username: ${{secrets.MAIL_USERNAME}} + password: ${{secrets.MAIL_PASSWORD}} + from: MorphoCloudPortal + subject: + "[MorphoCloudPortal] Instance ${{ github.event.issue.number }} + stopped" + body: Instance ${{ github.event.issue.number }} stopped diff --git a/.github/workflows/create-instance.yml b/.github/workflows/create-instance.yml index 65cf5939e..77d842c15 100644 --- a/.github/workflows/create-instance.yml +++ b/.github/workflows/create-instance.yml @@ -17,3 +17,17 @@ jobs: echo Creating instance associated with issue $NUMBER env: NUMBER: ${{ github.event.issue.number }} + + - name: Send mail + uses: dawidd6/action-send-mail@2cea9617b09d79a095af21254fbcb7ae95903dde # v3.12.0 + with: + server_address: smtp.gmail.com + server_port: 465 + secure: true + username: ${{secrets.MAIL_USERNAME}} + password: ${{secrets.MAIL_PASSWORD}} + from: MorphoCloudPortal + subject: + "[MorphoCloudPortal] Instance ${{ github.event.issue.number }} + created" + body: Instance ${{ github.event.issue.number }} created