-
-
Notifications
You must be signed in to change notification settings - Fork 335
36 lines (33 loc) · 1.32 KB
/
fly-destroy.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
# This workflow runs in the target repo context, as it is triggered via pull_request_target.
# It does not, and should not have access to code in the PR.
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
name: fly.io Destroy
on:
pull_request_target:
branches: [ main ]
types: [unlabeled, closed]
# Allows running this workflow manually from the Actions tab
workflow_dispatch:
jobs:
destroy:
name: Remove app from fly.io
runs-on: ubuntu-22.04
# Remove the deployment when 'preview' label is removed, or the PR is closed.
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request_target' &&
(github.event.action == 'closed' ||
(github.event.action == 'unlabeled' && github.event.label.name == 'preview')))
steps:
- uses: actions/checkout@v4
- name: Set up flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
with:
version: 0.2.72
- name: Destroy fly.io app
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
BRANCH_NAME: ${{ github.event.pull_request.head.repo.full_name }}-${{ github.event.pull_request.head.ref }}
# See fly-build for what BRANCH_NAME looks like.
id: fly_destroy
run: node buildtools/fly-deploy.js destroy