-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
37 lines (34 loc) · 1.24 KB
/
Copy pathcleanup-e2e-workers.yml
File metadata and controls
37 lines (34 loc) · 1.24 KB
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
name: 'Automation: Cleanup E2E workers'
on:
pull_request:
types:
- closed
jobs:
cleanup:
# The optional E2E job deploys only for PRs from this repository, so forks never have a worker to delete.
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions: {}
timeout-minutes: 5
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
strategy:
matrix:
# Name prefix of every E2E app that deploys a real worker, see the app's global-setup.ts
worker-prefix:
- e2e-send-to-sentry
- e2e-flue-send-to-sentry
steps:
- name: Set up Node
uses: actions/setup-node@v7
with:
node-version: 24
- name: Delete worker
run: |
WORKER="${{ matrix.worker-prefix }}-pr-${{ github.event.pull_request.number }}"
if ! output=$(npx --yes wrangler@4 delete --name "$WORKER" --force 2>&1); then
echo "$output"
# 10007 and 10090 mean the worker does not exist, e.g. the PR never ran the optional E2E job.
echo "$output" | grep -Eq 'code: (10007|10090)\]' || exit 1
fi