generated from int128/typescript-actions-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 7
103 lines (93 loc) · 3.53 KB
/
delete-pull-request-namespaces.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: delete-pull-request-namespaces
on:
pull_request:
paths:
- delete-pull-request-namespaces/**
- '*.json'
- '*.yaml'
- .github/workflows/delete-pull-request-namespaces.yaml
push:
branches:
- main
paths:
- delete-pull-request-namespaces/**
- '*.json'
- '*.yaml'
- .github/workflows/delete-pull-request-namespaces.yaml
concurrency:
group: ${{ github.workflow }}--${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: delete-pull-request-namespaces
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 20
- run: corepack enable pnpm
- run: pnpm i
- run: pnpm test
e2e-test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 20
- run: corepack enable pnpm
- run: pnpm i
- run: pnpm build
- run: |
git config --global user.email 'github-actions@github.com'
git config --global user.name 'github-actions'
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.head_ref }} # avoid "shallow update not allowed" error
path: overlay-branch
- name: Set up an overlay branch
working-directory: overlay-branch
run: |
mkdir -vp monorepo-deploy-actions/overlay-${{ github.run_id }}
cd monorepo-deploy-actions/overlay-${{ github.run_id }}
touch pr-1.yaml
touch pr-2.yaml
touch pr-${{ github.event.pull_request.number }}.yaml
git add .
git commit -m "Add overlay branch for e2e-test of ${GITHUB_REF}"
git push origin "HEAD:refs/heads/delete-pull-request-namespaces-${{ github.run_id }}"
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.head_ref }} # avoid "shallow update not allowed" error
path: namespace-branch
- name: Set up an namespace branch
working-directory: namespace-branch
run: |
touch dummy
git add .
git commit -m "Add namespace branch for e2e-test of ${GITHUB_REF}"
git push origin "HEAD:refs/heads/ns/monorepo-deploy-actions/overlay-${{ github.run_id }}/pr-${{ github.event.pull_request.number }}"
- uses: ./delete-pull-request-namespaces
id: delete-pull-request-namespaces
with:
overlay: overlay-${{ github.run_id }}
namespace-prefix: pr-
destination-repository: ${{ github.repository }}
destination-branch: delete-pull-request-namespaces-${{ github.run_id }}
exclude-label: skip-nightly-stop
remove-label-on-deletion: deploy
- name: Clean up the overlay branch
continue-on-error: true
if: always()
run: |
git push origin --delete "refs/heads/delete-pull-request-namespaces-${{ github.run_id }}"
- name: Clean up the namespace branch
continue-on-error: true
if: always()
run: |
git push origin --delete "refs/heads/ns/monorepo-deploy-actions/overlay-${{ github.run_id }}/pr-${{ github.event.pull_request.number }}"