Skip to content

chore(ui5-carousel): standardize internal naming (slide→page, remove Active/Selected/Viewport) #294

chore(ui5-carousel): standardize internal naming (slide→page, remove Active/Selected/Viewport)

chore(ui5-carousel): standardize internal naming (slide→page, remove Active/Selected/Viewport) #294

name: Reset Preview Deploy
on:
pull_request:
types: [closed]
branches:
- main
paths:
- 'packages/website/**'
- 'docs/**'
- '*.md'
- 'README.md'
- 'packages/base/src/**/*.css'
- 'packages/base/src/**/*.ts'
- 'packages/ai/src/**/*.css'
- 'packages/ai/src/**/*.ts'
- 'packages/compat/src/**/*.css'
- 'packages/compat/src/**/*.ts'
- 'packages/fiori/src/**/*.css'
- 'packages/fiori/src/**/*.ts'
- 'packages/main/src/**/*.css'
- 'packages/main/src/**/*.ts'
- '!**/*.spec.ts'
- '!**/*.test.ts'
- '!**/test/**'
jobs:
cleanup-preview:
runs-on: ubuntu-latest
steps:
- name: Create empty content
run: |
mkdir -p empty-site
cat > empty-site/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Preview Cleaned Up</title>
</head>
<body>
<h1>Preview Cleaned Up</h1>
<p>This preview deployment has been cleaned up because the associated pull request was closed.
</p>
</body>
</html>
EOF
- name: Deploy empty content
uses: nwtgck/[email protected]
with:
publish-dir: './empty-site'
production-deploy: false
github-token: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
deploy-message: "chore: cleanup preview for closed PR #${{ github.event.number }}"
alias: pr-${{ github.event.number }}
enable-pull-request-comment: false
enable-commit-comment: false
overwrites-pull-request-comment: false
github-deployment-environment: preview
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Update PR with cleanup notification
uses: actions/github-script@v7
with:
github-token: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
script: |
const prNumber = context.payload.pull_request.number;
const cleanupUrl = `https://pr-${prNumber}--ui5-webcomponents.netlify.app`;
const commentBody = `🧹 **Preview deployment cleaned up**: ${cleanupUrl}`;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber
});
const existingComment = comments.find(comment =>
comment.user.login === 'ui5-webcomponents-bot' && (
comment.body.includes('Deployed on') || comment.body.includes('Deploy Preview for PR'))
);
if (existingComment) {
// Update existing comment to show cleanup
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: commentBody
});
} else {
// Create new cleanup notification if no deployment comment exists
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: commentBody
});
}