-
Notifications
You must be signed in to change notification settings - Fork 5
52 lines (46 loc) · 1.67 KB
/
preevy-down.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
name: Teardown Preevy environment
on:
pull_request:
types:
- closed
permissions:
id-token: write
contents: read
concurrency: preevy-${{ github.event.number }}
jobs:
teardown:
permissions: write-all
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v3
- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.PREEVY_SA_KEY }}'
- uses: livecycle/[email protected]
with:
profile-url: ${{ vars.PREEVY_PROFILE_URL }}
install: gh-release
args: "--force"
#
# OPTIONAL: delete GH deployments and environments
# Requires a custom GH app installed on this repo.
# See https://github.com/marketplace/actions/delete-deployment-environment#how-to-obtain-the-proper-token
# To disable this feature, remove the rest of the steps starting here
#
# Points to a recent commit instead of `main` to avoid supply chain attacks. (The latest tag is very old.)
- name: 🎟 Get GitHub App token
uses: navikt/github-app-token-generator@a3831f44404199df32d8f39f7c0ad9bb8fa18b1c
id: get-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: 🗑 Delete deployment environment
uses: strumwolf/[email protected]
with:
# Use a JWT created with your GitHub App's private key
token: ${{ steps.get-token.outputs.token }}
environment: pr-${{ github.event.number }}
ref: ${{ github.ref_name }}