diff --git a/.github/workflows/send_email.yml b/.github/workflows/send_email.yml new file mode 100644 index 00000000000..d1be170ab2d --- /dev/null +++ b/.github/workflows/send_email.yml @@ -0,0 +1,31 @@ +name: Send Email + +on: + workflow_call: + inputs: + message: + description: 'Message to send' + required: true + type: string + email: + description: 'Email address to send to' + required: true + type: string + secrets: + private_key: + required: true + user: + required: true + +jobs: + send_email: + runs-on: ubuntu-latest + steps: + - name: install ssh keys + run: | + install -m 600 -D /dev/null ~/.ssh/id_rsa + echo "${{ secrets.private_key }}" > ~/.ssh/id_rsa + ssh-keyscan -H ${{ vars.CGAL_SEND_EMAIL_SSH_HOST }} > ~/.ssh/known_hosts + - name: send email via ssh + run: | + echo "${{ inputs.message }}" | ssh ${{ secrets.user }}@${{ vars.CGAL_SEND_EMAIL_SSH_HOST }} "/sbin/sendmail -t ${{ inputs.email }}"