-
Notifications
You must be signed in to change notification settings - Fork 109
37 lines (36 loc) · 1.65 KB
/
TEARDOWN_PLAYGROUND_PREVIEW.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
name: Teardown playground preview
on:
pull_request:
types: [ unlabeled, closed ]
jobs:
teardown:
# check whether the unlabel name was deploy-preview || check whether the PR was closed / merged and whether deploy-preview was part of the array
if: github.event.label.name == 'deploy-preview' || (github.event.action == 'closed' && contains( github.event.pull_request.labels.*.name, 'deploy-preview'))
name: teardown-${{ github.head_ref || github.event.ref }} # env is not yet available here
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{ github.head_ref || github.event.ref }} # head_ref = branch on PR, event.ref stable/**
steps:
- id: sanitize
name: Sanitize form-playground branch name
uses: camunda/infra-global-github-actions/sanitize-branch-name@main
with:
branch: ${{ env.BRANCH_NAME }}
max_length: '25'
- name: Save form-playground branch name
run: echo "PREVIEW_BRANCH_NAME=demo-${{ steps.sanitize.outputs.branch_name }}" >> $GITHUB_ENV
- name: Remove form-playground branch
uses: dawidd6/action-delete-branch@145cd9febe29b6d83e19682d4b95849b851f544c
with:
github_token: ${{ secrets.ADD_TO_HTO_PROJECT_PAT }}
owner: camunda
repository: form-playground
branches: ${{ env.PREVIEW_BRANCH_NAME }}
- uses: bobheadxi/deployments@8a87bc300d207ce86142a8080e9b8fabec463494
if: always()
name: Deactivate GitHub Deployment environment
with:
step: deactivate-env
env: ${{ env.PREVIEW_BRANCH_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ env.BRANCH_NAME }}