This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
53 lines (49 loc) · 1.68 KB
/
on_pr_closed.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Pull Request Closed
env:
ACRONYM: vscf
APP_NAME: vue-scaffold
NAMESPACE_PREFIX: 1dca6b
on:
pull_request:
branches:
- master
types:
- closed
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
remove-pr-dev:
name: Remove PR build from dev namespace
if: "! github.event.pull_request.head.repo.fork"
environment:
name: pr
url: https://${{ env.ACRONYM }}-dev-pr-${{ github.event.number }}.apps.silver.devops.gov.bc.ca
runs-on: ubuntu-latest
timeout-minutes: 12
steps:
- name: Checkout
uses: actions/checkout@v3
# - name: Login to OpenShift Cluster
# uses: redhat-actions/oc-login@v1
# with:
# openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
# openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
# insecure_skip_tls_verify: true
# namespace: ${{ env.NAMESPACE_PREFIX }}-dev
# - name: Remove PR Deployment
# shell: bash
# run: |
# oc delete -n ${{ env.NAMESPACE_PREFIX }}-dev all,secret,networkpolicy,rolebinding --selector app=${{ env.APP_NAME }}-pr-${{ github.event.number }}
# oc delete -n ${{ env.NAMESPACE_PREFIX }}-dev all,svc,cm,sa,role,secret --selector cluster-name=pr-${{ github.event.number }}
- name: Remove Release Comment on PR
uses: marocchino/sticky-pull-request-comment@v2
with:
header: release
delete: true
- name: Remove Github Deployment Environment
uses: strumwolf/delete-deployment-environment@v2
with:
environment: pr
onlyRemoveDeployments: true
token: ${{ secrets.GITHUB_TOKEN }}