-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpull-request-closed.yml
42 lines (35 loc) · 1.25 KB
/
pull-request-closed.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#
# pull-request.yml
# Use this workflow to delete pull request environments.
name: Delete Pull Request Environment
on:
pull_request:
types:
- closed
env:
# The path on the server to delete, relative to the runner user's home directory.
# Must match the value in pull-request.yml
# Uncomment to change the default.
# DDEV_PROJECT_PATH: "Sites/${{ github.repository }}/pr${{ github.event.number }}"
jobs:
delete:
name: Delete Environment
# The label of the runner you wish to use.
# Must match the runner that pull-request.yml uses.
runs-on: dev.myserver.com
steps:
# Find absolute path to the site using the runner's home directory.
# This frees us from having to add the absolute path of the runner to this file.
- name: Detect project path
run: |
echo "DDEV_PROJECT_PATH_FULL=$HOME/$DDEV_PROJECT_PATH" >> "$GITHUB_ENV"
# Removes the ddev services and data.
- name: Remove site
working-directory: ${{ env.DDEV_PROJECT_PATH_FULL }}
run: |
ddev remove --remove-data --omit-snapshot
# Removes the files.
- name: Remove code
working-directory: ${{ env.DDEV_PROJECT_PATH_FULL }}
run: |
rm -rf ${{ env.DDEV_PROJECT_PATH_FULL }}