From 0db4f644ce924c79fdc7ecee286435633293d246 Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Sat, 5 Nov 2022 13:52:01 -0700 Subject: [PATCH] Add review app workflow --- .github/workflows/review-app.yml | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/review-app.yml diff --git a/.github/workflows/review-app.yml b/.github/workflows/review-app.yml new file mode 100644 index 00000000..3bb546cc --- /dev/null +++ b/.github/workflows/review-app.yml @@ -0,0 +1,33 @@ +name: "Review app" +env: + DOKKU_GIT_REMOTE_URL: 'ssh://dokku@dokku.baby-buddy.net:22' + TRIGGER_LABEL: 'to review' +on: + pull_request: + types: [labeled, unlabeled] +jobs: + create-review-app: + runs-on: ubuntu-latest + if: github.event_name == 'labeled' && github.event.label.name == ${{ env.TRIGGER_LABEL }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Create review app + uses: dokku/github-action@master + with: + command: review-apps:create + git_remote_url: ${{ env.DOKKU_GIT_REMOTE_URL }}/demo + review_app_name: pr-${{ github.event.pull_request.number }} + ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }} + destroy-review-app: + runs-on: ubuntu-latest + if: github.event_name == 'unlabeled' && github.event.label.name == ${{ env.TRIGGER_LABEL }} + steps: + - name: Destroy review app + uses: dokku/github-action@master + with: + command: review-apps:destroy + git_remote_url: ${{ env.DOKKU_GIT_REMOTE_URL }}/demo + review_app_name: pr-${{ github.event.pull_request.number }} + ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}