Instance: Test ansible exosphere scripts update #659
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Send Email | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
send-email: | |
runs-on: self-hosted | |
if: | |
${{ !github.event.issue.pull_request && ( | |
contains(github.event.comment.body, '/email') ) }} | |
steps: | |
- name: email command | |
id: email_command | |
uses: github/[email protected] | |
with: | |
command: "/email" | |
reaction: "rocket" | |
allowed_contexts: "issue" | |
permissions: "read,triage,write,maintain,admin" | |
allowlist: | |
"${{ vars.MORPHOCLOUD_GITHUB_ADMINS }},${{ | |
github.event.issue.user.login }}" | |
- uses: actions/checkout@v4 | |
- name: Define instance name | |
id: define | |
uses: ./.github/actions/define-instance-name | |
with: | |
prefix: ${{ vars.INSTANCE_NAME_PREFIX }} | |
issue_number: ${{ github.event.issue.number }} | |
- name: Check instance exists | |
id: check_instance | |
if: ${{ steps.email_command.outputs.continue == 'true' }} | |
uses: ./.github/actions/check-instance-exists | |
with: | |
os_cloud: ${{ vars.MORPHOCLOUD_OS_CLOUD }} | |
instance_name: ${{ steps.define.outputs.instance_name }} | |
- name: command results comment (Instance does not exist) | |
if: | |
${{ steps.email_command.outputs.continue == 'true' && | |
steps.check_instance.outputs.exists == 'false' }} | |
uses: peter-evans/[email protected] | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
### Command Results ❌ | |
`email` command failed because **${{ steps.define.outputs.instance_name }}** instance does not exist. | |
See details at https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
- name: Send mail | |
id: send_email | |
uses: ./.github/actions/send-email | |
with: | |
os_cloud: ${{ vars.MORPHOCLOUD_OS_CLOUD }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
string_encryption_key: ${{ secrets.STRING_ENCRYPTION_KEY }} | |
mail_server_username: ${{ secrets.MAIL_USERNAME }} | |
mail_server_password: ${{ secrets.MAIL_PASSWORD }} | |
instance_name: ${{ steps.define.outputs.instance_name }} | |
instance_issue_number: ${{ github.event.issue.number }} | |
- name: command results comment (failed) | |
if: ${{ steps.send_email.outcome == 'failure' && failure() }} | |
uses: peter-evans/[email protected] | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
### Command Results ❌ | |
`email` command failed to be applied to **${{ steps.define.outputs.instance_name }}** instance. ${{ steps.send_email.outputs.error_message }} | |
See details at https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
- name: command results comment (success) | |
if: ${{ steps.send_email.outcome == 'success' && success() }} | |
uses: peter-evans/[email protected] | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
`email` command successfully completed for **${{ steps.define.outputs.instance_name }}** instance ✅ |