Skip to content

Commit 44d291f

Browse files
ci: add cleanup
1 parent efb28ec commit 44d291f

File tree

4 files changed

+30
-19
lines changed

4 files changed

+30
-19
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This workflow deletes the preview deployments created for pull requests
2+
name: PR Preview Cleanup
3+
4+
on:
5+
pull_request:
6+
types: [closed]
7+
8+
jobs:
9+
cleanup-pr-previews:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Delete

.github/workflows/pr-preview.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ name: PR Preview
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened]
5+
types: [opened, synchronize, reopened, closed]
66

77
concurrency:
88
group: pr-preview-${{ github.event.number }}
99
cancel-in-progress: true
1010

1111
jobs:
1212
build-publish-library:
13+
if: ${{ github.event.action != 'closed' }}
1314
uses: ./.github/workflows/shared-build-publish-libraries.yml
1415
secrets: inherit
1516
permissions:
@@ -103,6 +104,7 @@ jobs:
103104
pages: write
104105

105106
comment-pr:
107+
if: ${{ github.event.action != 'closed' }}
106108
needs:
107109
- build-publish-library
108110
- build-deploy-html-cdn-example

.github/workflows/shared-build-deploy-example.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,34 +86,32 @@ jobs:
8686
# sparse-checkout-cone-mode: false
8787

8888
- name: Enable corepack and install pnpm
89+
if: ${{ github.event.action != 'closed' }}
8990
run: |
9091
corepack enable
9192
9293
- name: Set up Node.js
94+
if: ${{ github.event.action != 'closed' }}
9395
uses: actions/setup-node@v6
9496
with:
9597
node-version: '24'
9698
cache: 'pnpm'
9799

98100
- name: Update ${{ inputs.name }} to use published version
101+
if: ${{ github.event.action != 'closed' }}
99102
run: |
100103
pnpm run --filter='${{ inputs.name }}' cicd-update-version
101104
102105
- name: Install dependencies
106+
if: ${{ github.event.action != 'closed' }}
103107
run: pnpm install --filter='${{ inputs.name }}' --no-frozen-lockfile
104108

105109
- name: Build ${{ inputs.name }} example
110+
if: ${{ github.event.action != 'closed' }}
106111
run: |
107112
pnpm --filter='${{ inputs.name }}' build
108113
109114
# Deploy the built example
110-
111-
# PR Preview Action requires sparse checkout to be disabled
112-
- name: Disable sparse checkout for deployment
113-
run: |
114-
git config core.sparseCheckout false || true
115-
rm -f .git/info/sparse-checkout || true
116-
117115
- name: Deploy PR Preview
118116
if: ${{ inputs.deployment == 'pr' }}
119117
id: deploy-pr

.github/workflows/shared-build-deploy-storybook.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
steps:
4040
# wait for required packages to be available
4141
- name: Wait for packages to be available on NPM
42+
if: ${{ github.event.action != 'closed' }}
4243
run: |
4344
echo "Waiting for packages to be available: ${PACKAGES}"
4445
@@ -73,43 +74,38 @@ jobs:
7374
7475
# Build the example
7576
- uses: actions/checkout@v5
77+
if: ${{ github.event.action != 'closed' }}
7678
with:
7779
fetch-depth: 0
78-
# sparse-checkout: |
79-
# packages/components
80-
# pnpm-workspace.yaml
81-
# pnpm-lock.yaml
82-
# sparse-checkout-cone-mode: false
8380

8481
- name: Enable corepack and install pnpm
82+
if: ${{ github.event.action != 'closed' }}
8583
run: |
8684
corepack enable
8785
8886
- name: Set up Node.js
87+
if: ${{ github.event.action != 'closed' }}
8988
uses: actions/setup-node@v6
9089
with:
9190
node-version: '24'
9291
cache: 'pnpm'
9392

9493
- name: Install dependencies
94+
if: ${{ github.event.action != 'closed' }}
9595
run: pnpm install --filter='@infineon/infineon-design-system-stencil' --no-frozen-lockfile
9696

9797
- name: Update ${{ inputs.name }} to use published version
98+
if: ${{ github.event.action != 'closed' }}
9899
working-directory: packages/components
99100
run: |
100101
pnpm version ${{ inputs.package-version }} --no-git-tag-version
101102
102103
- name: Build Storybook
104+
if: ${{ github.event.action != 'closed' }}
103105
run: |
104106
pnpm --filter='@infineon/infineon-design-system-stencil' build-storybook
105107
106108
# Deploy
107-
# PR Preview Action requires sparse checkout to be disabled
108-
- name: Disable sparse checkout for deployment
109-
run: |
110-
git config core.sparseCheckout false || true
111-
rm -f .git/info/sparse-checkout || true
112-
113109
- name: Deploy PR Preview
114110
if: ${{ inputs.deployment == 'pr' }}
115111
id: deploy-pr

0 commit comments

Comments
 (0)