diff --git a/.github/ISSUE_TEMPLATE/request.yml b/.github/ISSUE_TEMPLATE/request.yml index 9932f04b..da5e010a 100644 --- a/.github/ISSUE_TEMPLATE/request.yml +++ b/.github/ISSUE_TEMPLATE/request.yml @@ -33,3 +33,10 @@ body: description: Briefly describe how you will be using the instance. validations: required: false + + - type: textarea + attributes: + label: Email + description: Email to use for notifications. + validations: + required: true diff --git a/.github/workflows/control-instance.yml b/.github/workflows/control-instance.yml index eec2e996..9555b5ce 100644 --- a/.github/workflows/control-instance.yml +++ b/.github/workflows/control-instance.yml @@ -20,6 +20,30 @@ jobs: env: NUMBER: ${{ github.event.issue.number }} + - name: Extract email + id: extract + run: | + email=$( + echo ${{ toJSON(steps.parse.outputs.data) }} | + jq -r ".email.text" + ) + echo "email=$email" >> $GITHUB_OUTPUT + + - 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 + to: ${{ steps.extract.outputs.email }} + subject: + "[MorphoCloudPortal] Instance ${{ github.event.issue.number }} + started" + body: Instance ${{ github.event.issue.number }} started + stop: runs-on: self-hosted if: @@ -30,3 +54,31 @@ jobs: echo Stopping instance associated with issue $NUMBER env: NUMBER: ${{ github.event.issue.number }} + + - name: Issue Forms Body Parser + id: parse + uses: zentered/issue-forms-body-parser@v2.0.0 + + - name: Extract email + id: extract + run: | + email=$( + echo ${{ toJSON(steps.parse.outputs.data) }} | + jq -r ".email.text" + ) + echo "email=$email" >> $GITHUB_OUTPUT + + - 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 + to: ${{ steps.extract.outputs.email }} + 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 65cf5939..42ae4d4d 100644 --- a/.github/workflows/create-instance.yml +++ b/.github/workflows/create-instance.yml @@ -17,3 +17,31 @@ jobs: echo Creating instance associated with issue $NUMBER env: NUMBER: ${{ github.event.issue.number }} + + - name: Issue Forms Body Parser + id: parse + uses: zentered/issue-forms-body-parser@v2.0.0 + + - name: Extract email + id: extract + run: | + email=$( + echo ${{ toJSON(steps.parse.outputs.data) }} | + jq -r ".email.text" + ) + echo "email=$email" >> $GITHUB_OUTPUT + + - 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 + to: ${{ steps.extract.outputs.email }} + subject: + "[MorphoCloudPortal] Instance ${{ github.event.issue.number }} + created" + body: Instance ${{ github.event.issue.number }} created