-
Notifications
You must be signed in to change notification settings - Fork 51
44 lines (39 loc) · 1.38 KB
/
delete_pr_closed_job.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
43
44
name: Clean up
on:
pull_request:
types:
- closed
jobs:
uninstall:
name: Uninstall PR
runs-on: ubuntu-20.04
if: github.repository_owner == 'bcgov'
steps:
- uses: actions/checkout@v3
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
certificate_authority_data: ${{ secrets.OPENSHIFT_CA_CRT }}
namespace: ${{ secrets.OPENSHIFT_NAMESPACE }}
- name: Unistall Traction PR Helm
run: |
helm uninstall pr-${{ github.event.number }}-traction
- name: Remove Traction Openshift Objects
continue-on-error: true
run: |
oc delete all,secret,pod,networkpolicy,configmap,pvc --selector "app.kubernetes.io/instance"=pr-${{ github.event.number }}-traction
clean-ghcr:
runs-on: ubuntu-20.04
name: Delete closed or stale pr images
steps:
- name: Delete containers
uses: snok/container-retention-policy@v2
with:
image-names: traction-plugins-acapy, traction-tenant-proxy,traction-tenant-ui
cut-off: One month ago UTC
account-type: org
org-name: ${{ github.repository_owner}}
filter-tags: ${{ github.event.number }}
token: ${{ secrets.PAT }}