Skip to content

deps: update dependency vercel to v50 #151

deps: update dependency vercel to v50

deps: update dependency vercel to v50 #151

Workflow file for this run

name: Cleanup Preview
on:
pull_request:
types: [closed]
jobs:
cleanup:
name: Cleanup Preview Environment
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup workspace
uses: ./.github/actions/setup-workspace
- name: Pull Vercel Environment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: |
npx vercel pull --yes --environment=preview --token=$VERCEL_TOKEN
- name: Delete Preview Database
env:
TURSO_PLATFORM_API_TOKEN: ${{ secrets.TURSO_PLATFORM_API_TOKEN }}
TURSO_ORGANIZATION: ${{ secrets.TURSO_ORG_SLUG }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -a
source .vercel/.env.preview.local
set +a
DB_NAME="next-lift-preview-pr${PR_NUMBER}-auth"
# データベースを削除
DELETE_OUTPUT=$(pnpm --filter @next-lift/turso run db:delete --name="${DB_NAME}" 2>&1) || {
# 存在しない場合のエラーは無視
if echo "${DELETE_OUTPUT}" | grep -q "404"; then
echo "Database ${DB_NAME} was already deleted or does not exist."
exit 0
else
echo "Error deleting database: ${DELETE_OUTPUT}"
exit 1
fi
}
echo "Successfully deleted database: ${DB_NAME}"
- name: Comment PR with Cleanup Info
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
with:
script: |
const prNumber = process.env.PR_NUMBER;
const body = [
'## 🗑️ Preview Environment Cleaned Up',
'',
'✅ プレビュー環境をクリーンアップしました!',
'',
`**Database Name**: next-lift-preview-pr${prNumber}-auth`,
'',
'> PRがクローズされたため、関連するデータベースとVercel環境変数を自動的に削除しました。'
].join('\n');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});