Control Instance #699
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: Control Instance | |
on: | |
issue_comment: | |
types: [created] | |
# Permissions needed for reacting to IssueOps commands on issues | |
permissions: | |
issues: write | |
checks: read | |
jobs: | |
control: | |
runs-on: self-hosted | |
if: | |
${{ !github.event.issue.pull_request && ( | |
contains(github.event.comment.body, '/unshelve') || | |
contains(github.event.comment.body, '/shelve') || | |
contains(github.event.comment.body, '/delete_instance') ) }} | |
steps: | |
- name: unshelve command | |
id: unshelve_command | |
uses: github/[email protected] | |
with: | |
command: "/unshelve" | |
reaction: "rocket" | |
allowed_contexts: "issue" | |
permissions: "read,triage,write,maintain,admin" | |
allowlist: | |
"${{ vars.MORPHOCLOUD_GITHUB_ADMINS }},${{ | |
github.event.issue.user.login }}" | |
- name: shelve command | |
id: shelve_command | |
uses: github/[email protected] | |
with: | |
command: "/shelve" | |
reaction: "rocket" | |
allowed_contexts: "issue" | |
permissions: "read,triage,write,maintain,admin" | |
allowlist: | |
"${{ vars.MORPHOCLOUD_GITHUB_ADMINS }},${{ | |
github.event.issue.user.login }}" | |
- name: delete command | |
id: delete_command | |
uses: github/[email protected] | |
with: | |
command: "/delete_instance" | |
reaction: "rocket" | |
allowed_contexts: "issue" | |
permissions: "write,maintain,admin" | |
allowlist: "${{ vars.MORPHOCLOUD_GITHUB_ADMINS }}" | |
- name: Set command metadata | |
id: command | |
if: | |
${{ steps.unshelve_command.outputs.continue == 'true' || | |
steps.shelve_command.outputs.continue == 'true' || | |
steps.delete_command.outputs.continue == 'true' }} | |
run: | | |
if [[ "$UNSHELVE_COMMAND_CONTINUE" == "true" ]]; then | |
continue="$UNSHELVE_COMMAND_CONTINUE" | |
command_name="unshelve" | |
comment_id="${{ steps.unshelve_command.outputs.comment_id }}" | |
elif [[ "$SHELVE_COMMAND_CONTINUE" == "true" ]]; then | |
continue="$SHELVE_COMMAND_CONTINUE" | |
command_name="shelve" | |
comment_id="${{ steps.shelve_command.outputs.comment_id }}" | |
elif [[ "$DELETE_COMMAND_CONTINUE" == "true" ]]; then | |
continue="$DELETE_COMMAND_CONTINUE" | |
command_name="delete" | |
comment_id="${{ steps.delete_command.outputs.comment_id }}" | |
else | |
continue="false" | |
command_name="" | |
comment_id="" | |
fi | |
echo "continue=$continue" >> $GITHUB_OUTPUT | |
echo "command_name=$command_name" >> $GITHUB_OUTPUT | |
echo "comment_id=$comment_id" >> $GITHUB_OUTPUT | |
env: | |
UNSHELVE_COMMAND_CONTINUE: | |
${{ steps.unshelve_command.outputs.continue }} | |
SHELVE_COMMAND_CONTINUE: ${{ steps.shelve_command.outputs.continue }} | |
DELETE_COMMAND_CONTINUE: ${{ steps.delete_command.outputs.continue }} | |
- uses: actions/checkout@v4 | |
- name: Control instance | |
id: control_instance | |
if: ${{ steps.command.outputs.continue == 'true' }} | |
uses: ./.github/actions/control-instance | |
with: | |
os_cloud: ${{ vars.MORPHOCLOUD_OS_CLOUD }} | |
issue_number: ${{ github.event.issue.number }} | |
command_name: ${{ steps.command.outputs.command_name }} | |
instance_name_prefix: ${{ vars.INSTANCE_NAME_PREFIX }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
string_encryption_key: ${{ secrets.STRING_ENCRYPTION_KEY }} | |
mail_server_username: ${{secrets.MAIL_USERNAME}} | |
mail_server_password: ${{secrets.MAIL_PASSWORD}} |