-
Notifications
You must be signed in to change notification settings - Fork 70
39 lines (38 loc) · 1.33 KB
/
tugboat-pr-closed.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
name: Delete Tugboat Preview
on:
pull_request:
types:
- closed
paths-ignore:
- '**.md'
jobs:
tugboat_delete_preview:
runs-on: self-hosted
env:
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
name: Delete Tugboat Preview
steps:
- name: Restore Preview ID
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: .tugboat_preview.txt
key: ${{ runner.os }}-tugboat-preview-id-pr-${{ github.event.pull_request.number }}
- name: Set Preview ID
run: |
if ! [ -f .tugboat_preview.txt ]; then
echo "Preview ID not found, please manually delete Tugboat Preview. Contact platform-cms-qa on Github or CMS QA Engineers in #cms-support on Slack for assistance."
exit 1
fi
PREVIEW_ID=$(cat .tugboat_preview.txt)
echo "Preview ID: ${PREVIEW_ID}"
echo "PREVIEW_ID=$PREVIEW_ID" >> $GITHUB_ENV
- name: Cleanup temporary file
run: rm .tugboat_preview.txt
- name: Delete Tugboat Preview
run: |
curl --fail \
-H "Authorization: Bearer ${{ secrets.TUGBOAT_API_TOKEN }}" \
-H "Content-Type: application/json" \
-X DELETE \
-d '{ "force": "false" }' \
https://api.tugboat.vfs.va.gov/v3/previews/${{ env.PREVIEW_ID }}