-
Notifications
You must be signed in to change notification settings - Fork 43
31 lines (26 loc) · 1.11 KB
/
pr-close.yaml
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
name: PR close cleanup
on:
pull_request:
types: [closed]
branches:
- "*"
jobs:
build:
runs-on: self-hosted
steps:
- name: Set container names
run: |
echo "WEB_CONNECT_CONTAINER_NAME=web-connect-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "WEB_STAKING_CONTAINER_NAME=web-staking-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
- name: Check if containers exist and remove them
run: |
# Check if the web-connect container exists, and remove it if it does
if [ "$(docker ps -a -q -f name=${{ env.WEB_CONNECT_CONTAINER_NAME }})" ]; then
docker stop ${{ env.WEB_CONNECT_CONTAINER_NAME }} || true
docker rm ${{ env.WEB_CONNECT_CONTAINER_NAME }} || true
fi
# Check if the web-staking container exists, and remove it if it does
if [ "$(docker ps -a -q -f name=${{ env.WEB_STAKING_CONTAINER_NAME }})" ]; then
docker stop ${{ env.WEB_STAKING_CONTAINER_NAME }} || true
docker rm ${{ env.WEB_STAKING_CONTAINER_NAME }} || true
fi