Create test environment from PR comment #21
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: Create test environment from PR comment | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
execute_script: | |
runs-on: ubuntu-latest | |
environment: DEV | |
steps: | |
- name: Extract and set branch variable from comment | |
if: contains(github.event.comment.body, 'create testenv ') && github.event.comment.body != 'create testenv' | |
run: | | |
echo "branch=$(echo '${{ github.event.comment.body }}' | grep -oP '(?<=create testenv )\w+')" >> $GITHUB_ENV | |
- name: Execute Script on Remote Server | |
if: ${{ env.branch != '' }} | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.TEST_ENV_SSH_HOST }} | |
username: ${{ secrets.TEST_ENV_SSH_USER }} | |
key: ${{ secrets.TEST_ENV_SSH_KEY }} | |
script: | | |
BRANCH=${{ env.branch }} | |
echo ${{ secrets.TEST_ENV_SUDO_PWD }} | sudo -S -E /srv/anet_testing/odoo/tools/test_environment/deploy.sh create $BRANCH |