Skip to content

Add delete old deplyoments script#2334

Open
witoszekdev wants to merge 3 commits into
mainfrom
add-delete-old-deployments
Open

Add delete old deplyoments script#2334
witoszekdev wants to merge 3 commits into
mainfrom
add-delete-old-deployments

Conversation

@witoszekdev
Copy link
Copy Markdown
Contributor

@witoszekdev witoszekdev commented Apr 21, 2026

Adds script to delete old deployments from Vercel.

Requires installing Vercel CLI - script fetches deployments from their API and outputs it as a command to run via Vercel CLI.

The actual safety check is done by Vercel CLI: --safe flag makes sure that no deployment is deleted if it has alias assigned (production, staging, branch name, etc.).

Deployments with alias have to be deleted manually, when no --safe --yes flags are passed, Vercel CLI asks for confirmation before delete.

Example output:

# saleor-app-avatax — 13 deployment(s) older than 7d
#   uid                                   created               target      aliasAssigned         substate    rb  customEnv        url
#   ------------------------------------  --------------------  ----------  --------------------  ----------  --  ---------------  ---
#   dpl_(ommmited)      2026-04-13T11:12:38Z  preview     2026-04-13T11:14:42Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-04-13T10:38:08Z  preview     2026-04-13T10:40:17Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-04-10T11:14:04Z  preview     2026-04-10T11:15:52Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-04-10T10:31:53Z  preview     2026-04-10T10:34:02Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-04-08T15:18:08Z  preview     2026-04-08T15:20:15Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-04-08T11:07:39Z  preview     2026-04-08T11:09:25Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-03-30T15:41:16Z  preview     2026-03-30T15:43:22Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-03-30T10:59:52Z  preview     2026-03-30T11:01:58Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-03-27T14:02:23Z  preview     2026-03-27T14:04:41Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-03-26T21:55:54Z  preview     2026-03-26T21:58:22Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-03-26T10:51:58Z  preview     2026-03-26T10:54:09Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-03-23T09:43:52Z  preview     2026-03-23T09:45:53Z  STAGED      -   -                (ommited)
#   dpl_(ommmited)      2026-03-05T14:32:45Z  preview     2026-03-05T14:35:08Z  STAGED      -   -                (ommited)
# Review the list above. `--safe` will server-side skip any deployment
# that still has an active alias at the moment `vercel remove` runs.
vercel remove (actual deployments) --safe --yes -S <org_slug>

Copilot AI review requested due to automatic review settings April 21, 2026 15:13
@witoszekdev witoszekdev requested a review from a team as a code owner April 21, 2026 15:13
@witoszekdev witoszekdev requested a review from magul April 21, 2026 15:13
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 21, 2026

⚠️ No Changeset found

Latest commit: e01c12e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
saleor-app-avatax Ready Ready Preview Apr 21, 2026 3:15pm
saleor-app-cms Ready Ready Preview Apr 21, 2026 3:15pm
saleor-app-klaviyo Ready Ready Preview, Comment Apr 21, 2026 3:15pm
saleor-app-payment-np-atobarai Ready Ready Preview Apr 21, 2026 3:15pm
saleor-app-payment-stripe Ready Ready Preview, Comment Apr 21, 2026 3:15pm
saleor-app-products-feed Ready Ready Preview Apr 21, 2026 3:15pm
saleor-app-search Ready Ready Preview Apr 21, 2026 3:15pm
saleor-app-segment Ready Ready Preview Apr 21, 2026 3:15pm
saleor-app-smtp Ready Ready Preview Apr 21, 2026 3:15pm

Request Review

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 37.65%. Comparing base (ff25b52) to head (e01c12e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2334      +/-   ##
==========================================
+ Coverage   37.34%   37.65%   +0.30%     
==========================================
  Files        1021     1035      +14     
  Lines       66288    66851     +563     
  Branches     3428     3503      +75     
==========================================
+ Hits        24756    25170     +414     
- Misses      41156    41301     +145     
- Partials      376      380       +4     
Flag Coverage Δ
avatax 57.48% <ø> (+0.05%) ⬆️
cms 18.80% <ø> (+0.12%) ⬆️
domain 100.00% <ø> (ø)
dynamo-config-repository 79.29% <ø> (ø)
errors 91.66% <ø> (ø)
logger 28.81% <ø> (ø)
np-atobarai 72.58% <ø> (-0.07%) ⬇️
products-feed 5.97% <ø> (+0.05%) ⬆️
search 31.26% <ø> (-0.03%) ⬇️
segment 33.58% <ø> (+0.48%) ⬆️
shared 55.07% <ø> (+20.95%) ⬆️
smtp 35.74% <ø> (+0.07%) ⬆️
stripe 71.15% <ø> (+0.03%) ⬆️
webhook-utils 11.02% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a small “scripts” workspace package containing a maintenance script to help identify and delete old Vercel deployments across all apps in the monorepo, with optional alias fetching to aid review.

Changes:

  • Introduces scripts/remove-old-vercel-deployments.ts to list old deployments and print vercel remove ... --safe --yes commands.
  • Adds a scripts workspace package (tsconfig + package.json + README) and wires it into pnpm-workspace.yaml.
  • Updates cspell.config.js (new words) and updates pnpm-lock.yaml accordingly.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/tsconfig.json Adds TS config for the new scripts workspace.
scripts/remove-old-vercel-deployments.ts New Node/TS script to list old deployments and (optionally) fetch aliases.
scripts/package.json Defines the scripts workspace package and a pnpm script entrypoint.
scripts/README.md Documents how to run the script and how it works.
pnpm-workspace.yaml Registers scripts as a workspace package.
pnpm-lock.yaml Lockfile updates for the new workspace importer and dependency graph shifts.
cspell.config.js Adds spellchecker allowlist entries used in the new docs/script output.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread scripts/README.md
Comment on lines +33 to +43
```bash
# List old deployments for every app (default: older than 7 days)
VERCEL_TEAM_SLUG=... \
pnpm remove-old-vercel-deployments

# Only one app
pnpm remove-old-vercel-deployments --app=stripe

# Custom age threshold
pnpm remove-old-vercel-deployments --max-age-days=14
```
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage examples imply you can run this from the repo root via pnpm remove-old-vercel-deployments, but the root package.json doesn’t define that script. As written, users will need pnpm -C scripts remove-old-vercel-deployments or pnpm --filter @saleor/apps-scripts remove-old-vercel-deployments (and update the examples accordingly).

Copilot uses AI. Check for mistakes.
Comment thread scripts/README.md
Comment on lines +83 to +85
aliased ones from the batch. The script does NOT fetch aliases itself.

Recommended workflow:
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section says “The script does NOT fetch aliases itself”, but the script now has a --with-aliases flag that does fetch aliases and append them to the output. Please update the wording to clarify the default behavior vs the optional flag, so the docs don’t contradict the implementation.

Suggested change
aliased ones from the batch. The script does NOT fetch aliases itself.
Recommended workflow:
aliased ones from the batch. By default, the script does not fetch aliases
itself; if you pass `--with-aliases`, it fetches team aliases once and appends
each deployment's active alias domains to its output row for visibility.
Recommended workflow (default mode, without `--with-aliases`):

Copilot uses AI. Check for mistakes.
Comment thread scripts/README.md
| --- | --- | --- |
| `--max-age-days=<n>` | `7` | Consider deployments older than this many days. |
| `--app=<dirname>` | all | Limit to a single app directory under `apps/`. |
| `--with-aliases` | off | Fetch team aliases once and append each deployment's active alias domains to its row. Costs ~1 paginated API call regardless of project count. |
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --with-aliases description claims it “Costs ~1 paginated API call”, but alias listing is explicitly paginated and can take multiple requests depending on alias count. Consider rephrasing to something like “one paginated alias-listing loop for the whole team (not per project)”.

Suggested change
| `--with-aliases` | off | Fetch team aliases once and append each deployment's active alias domains to its row. Costs ~1 paginated API call regardless of project count. |
| `--with-aliases` | off | Fetch team aliases once and append each deployment's active alias domains to its row. Costs one paginated alias-listing loop for the whole team (not per project). |

Copilot uses AI. Check for mistakes.
Comment thread scripts/tsconfig.json
Comment on lines +2 to +12
"compilerOptions": {
"target": "es2023",
"module": "nodenext",
"moduleResolution": "nodenext",
"types": ["node"],
"strict": true,
"noEmit": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most workspaces in this repo extend @saleor/typescript-config-apps/base.json for consistent TS defaults. Consider doing the same here and only overriding the Node-specific bits (module/moduleResolution/types/target) so scripts stay aligned with repo-wide compiler settings.

Suggested change
"compilerOptions": {
"target": "es2023",
"module": "nodenext",
"moduleResolution": "nodenext",
"types": ["node"],
"strict": true,
"noEmit": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true
"extends": "@saleor/typescript-config-apps/base.json",
"compilerOptions": {
"target": "es2023",
"module": "nodenext",
"moduleResolution": "nodenext",
"types": ["node"]

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

Differences Found

⚠️ 1 packages or licenses were added.

Expand
License	Package
<<missing>> @saleor/apps-scripts

Summary

Expand
License Name Package Count Packages
0BSD 1
Packages
  • tslib
CC BY-SA 4.0 1
Packages
  • @cspell/dict-en-common-misspellings
CC0-1.0 1
Packages
  • type-fest
MIT (http://mootools.net/license.txt) 1
Packages
  • slick
MIT/X11 1
Packages
  • nub
Public Domain 1
Packages
  • jsonify
Python-2.0 1
Packages
  • argparse
SEE LICENSE IN LICENSE 1
Packages
  • spawndamnit
SEE LICENSE IN LICENSE.md 1
Packages
  • lightcookie
Unlicense 1
Packages
  • @sinonjs/text-encoding
WTFPL 1
Packages
  • opener
BlueOak-1.0.0 3
Packages
  • jackspeak
  • package-json-from-dist
  • path-scurry
CC-BY-4.0 3
Packages
  • @saleor/macaw-ui
  • caniuse-lite
  • saleor-apps
LGPL-3.0-or-later 11
Packages
  • @img/sharp-libvips-darwin-arm64
  • @img/sharp-libvips-darwin-x64
  • @img/sharp-libvips-linux-arm
  • @img/sharp-libvips-linux-arm64
  • @img/sharp-libvips-linux-s390x
  • @img/sharp-libvips-linux-x64
  • @img/sharp-libvips-linuxmusl-arm64
  • @img/sharp-libvips-linuxmusl-x64
  • @img/sharp-wasm32
  • @img/sharp-win32-ia32
  • @img/sharp-win32-x64
BSD-2-Clause 22
Packages
  • cheerio-select
  • css-select
  • css-what
  • domelementtype
  • domhandler
  • domutils
  • dotenv
  • entities
  • escodegen
  • eslint-scope
  • espree
  • esprima
  • esrecurse
  • estraverse
  • esutils
  • glob-to-regexp
  • nth-check
  • shimmer
  • terser
  • uglify-js
  • And 2 more...
<<missing>> 28
Packages
  • @saleor/app-problems
  • @saleor/apps-domain
  • @saleor/apps-logger
  • @saleor/apps-otel
  • @saleor/apps-scripts
  • @saleor/apps-shared
  • @saleor/apps-trpc
  • @saleor/apps-ui
  • @saleor/dynamo-config-repository
  • @saleor/errors
  • @saleor/eslint-config-apps
  • @saleor/handlebars
  • @saleor/react-hook-form-macaw
  • @saleor/sentry-utils
  • @saleor/typescript-config-apps
  • @saleor/webhook-utils
  • busboy
  • json-query
  • saleor-app-avatax
  • saleor-app-cms
  • And 8 more...
BSD-3-Clause 48
Packages
  • @protobufjs/aspromise
  • @protobufjs/base64
  • @protobufjs/codegen
  • @protobufjs/eventemitter
  • @protobufjs/fetch
  • @protobufjs/float
  • @protobufjs/inquire
  • @protobufjs/path
  • @protobufjs/pool
  • @protobufjs/utf8
  • @saleor/app-sdk
  • @saleor/eslint-plugin-saleor-app
  • @sentry/cli
  • @sentry/cli-darwin
  • @sentry/cli-linux-arm
  • @sentry/cli-linux-arm64
  • @sentry/cli-linux-i686
  • @sentry/cli-linux-x64
  • @sentry/cli-win32-i686
  • @sentry/cli-win32-x64
  • And 28 more...
ISC 55
Packages
  • @bundled-es-modules/cookie
  • @bundled-es-modules/statuses
  • @bundled-es-modules/tough-cookie
  • @isaacs/cliui
  • abbrev
  • anymatch
  • boolbase
  • cli-width
  • cliui
  • concat-with-sourcemaps
  • electron-to-chromium
  • fastq
  • flatted
  • foreground-child
  • form-data-lite
  • fs.realpath
  • get-caller-file
  • glob
  • glob-parent
  • graceful-fs
  • And 35 more...
Apache-2.0 239
Packages
  • @ampproject/remapping
  • @aws-crypto/crc32
  • @aws-crypto/crc32c
  • @aws-crypto/ie11-detection
  • @aws-crypto/sha1-browser
  • @aws-crypto/sha256-browser
  • @aws-crypto/sha256-js
  • @aws-crypto/supports-web-crypto
  • @aws-crypto/util
  • @aws-sdk/abort-controller
  • @aws-sdk/chunked-blob-reader
  • @aws-sdk/client-dynamodb
  • @aws-sdk/client-s3
  • @aws-sdk/client-sso
  • @aws-sdk/client-sso-oidc
  • @aws-sdk/client-sts
  • @aws-sdk/config-resolver
  • @aws-sdk/core
  • @aws-sdk/credential-provider-env
  • @aws-sdk/credential-provider-http
  • And 219 more...
MIT 1410
Packages
  • @0no-co/graphql.web
  • @adobe/css-tools
  • @algolia/cache-browser-local-storage
  • @algolia/cache-common
  • @algolia/cache-in-memory
  • @algolia/client-account
  • @algolia/client-analytics
  • @algolia/client-common
  • @algolia/client-personalization
  • @algolia/client-search
  • @algolia/logger-common
  • @algolia/logger-console
  • @algolia/recommend
  • @algolia/requester-browser-xhr
  • @algolia/requester-common
  • @algolia/requester-node-http
  • @algolia/transporter
  • @apidevtools/json-schema-ref-parser
  • @ardatan/relay-compiler
  • @ardatan/sync-fetch
  • And 1390 more...

@witoszekdev witoszekdev requested a review from lkostrowski April 21, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants