Skip to content

Commit 18a72bc

Browse files
committed
Merge branch 'feature/PI-601-workspace_destruction' into release/2024-11-06
2 parents acae57d + 50e6a6c commit 18a72bc

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/on-pr-close.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Workflow: PR Close"
2+
3+
permissions:
4+
id-token: write
5+
contents: read
6+
actions: write
7+
8+
env:
9+
TF_CLI_ARGS: -no-color
10+
CI_ROLE_NAME: ${{ secrets.CI_ROLE_NAME }}
11+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
12+
13+
on:
14+
pull_request:
15+
types: [closed]
16+
17+
jobs:
18+
parse-secrets:
19+
runs-on: [self-hosted, ci]
20+
steps:
21+
- id: parse-secrets
22+
run: |
23+
echo "::add-mask::${{ secrets.CI_ROLE_NAME }}"
24+
25+
build-base:
26+
runs-on: [self-hosted, ci]
27+
needs: [parse-secrets]
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
ref: ${{ env.BRANCH_NAME }}
32+
- uses: ./.github/actions/make/
33+
with:
34+
command: build
35+
save-to-cache: "true"
36+
restore-from-cache: "false"
37+
38+
destroy-pr-workspaces:
39+
runs-on: [self-hosted, ci]
40+
needs: [parse-secrets, build-base]
41+
steps:
42+
- uses: actions/checkout@v4
43+
with:
44+
ref: ${{ env.BRANCH_NAME }}
45+
fetch-depth: 0
46+
- name: Remove PR workspaces
47+
uses: ./.github/actions/make/
48+
with:
49+
command: destroy--redundant-workspaces BRANCH_NAME=origin/${{ env.BRANCH_NAME }} DESTROY_ALL_COMMITS_ON_BRANCH=true KILL_ALL=true TF_CLI_ARGS=${{ env.TF_CLI_ARGS }}
50+
requires-aws: true

0 commit comments

Comments
 (0)