一键导入
vercel-seat-saver
// Set up GitHub Actions to deploy Vercel apps via postagent. Uses postagent as the unified tool for both local setup and CI deployment — no Vercel CLI or GitHub CLI required.
// Set up GitHub Actions to deploy Vercel apps via postagent. Uses postagent as the unified tool for both local setup and CI deployment — no Vercel CLI or GitHub CLI required.
| name | vercel-seat-saver |
| description | Set up GitHub Actions to deploy Vercel apps via postagent. Uses postagent as the unified tool for both local setup and CI deployment — no Vercel CLI or GitHub CLI required. |
| version | 1.0.0 |
| author | actionbook |
| license | MIT |
| metadata | {"hermes":{"tags":["vercel","postagent","deployment","github-actions","ci-cd"],"category":"devops"}} |
Help the user set up a GitHub Actions workflow that deploys their app to Vercel, using postagent as the unified tool in both the local setup phase and the CI runtime.
postagent is your only tool for API operations, both locally and in CI. Key commands:
postagent manual <site> — progressive API discovery (site → group → action → full schema)postagent send <curl-style request> — execute an API call; credential placeholders like $POSTAGENT.VERCEL.API_KEY are auto-resolvedpostagent auth <site> — save credentials interactivelypostagent auth <site> --token <TOKEN> — save credentials non-interactively (used in CI)Available sites: vercel and github. Always use postagent manual to discover endpoints and parameters before building requests — do not guess.
Before starting, ensure locally:
postagent is installed — npm i -g postagent@latestpostagent auth vercel — Vercel API token is saved. To obtain a token: Vercel Dashboard > click avatar > Settings > Tokens. Collect the token through a secure input path — do not ask the user to paste it into normal chat.postagent auth github — GitHub personal access token is saved. To obtain a token: GitHub > click avatar > Settings > Developer settings > Personal access tokens > Tokens (classic) > Generate new token (classic). At minimum, select the repo scope.If auth is missing, guide the user through postagent auth first.
postagent for all Vercel and GitHub operations — do not add Python, Node.js, or shell wrapper scripts to send API requests when postagent can do it directlypostagent, reuse it instead of inventing a new installerUse postagent to discover and call Vercel's teams and projects API.
Goal: collect all static parameters — values that do not change between deployments:
teamIdprojectIdprojectNameThese values will be injected into GitHub secrets or workflow environment variables in a later step, so the CI workflow can reference them directly at runtime.
If the user doesn't have a Vercel project yet, use postagent to create one.
Before adding GitHub Actions, check whether the project already has Vercel's built-in GitHub connector. If it does, both systems will trigger duplicate deployments.
Use postagent to inspect the project detail. Key fields:
link — if populated, the project is Git-connectedconnectBuildsEnabled — if true, Git pushes trigger Vercel buildsIf Git-connected: warn the user that duplicate deployments will occur, and let them choose how to handle it:
"git": { "deploymentEnabled": false } to the project's vercel.json. This preserves the Git link but stops Vercel from auto-deploying on push.Present both options and let the user decide. Do not make the choice for them.
Store the static parameters from Step 1 in the GitHub repo so the workflow can reference them at runtime:
VERCEL_TOKEN) — store as GitHub Actions secretsteamId, projectId, projectName) — store as secrets or hardcode in the workflow env block, depending on user preferenceUse postagent to discover GitHub's secrets API and set the secrets programmatically. Note that GitHub's secret API requires encrypting values with the repo's public key (libsodium sealed box) — if this is too complex for the current environment, fall back to telling the user to add secrets manually in the GitHub UI.
Write a .github/workflows/vercel-deploy.yml in the user's repo. If a deploy workflow already exists, update it rather than creating a second one.
The workflow has two phases: set up postagent and deploy.
Phase 1 — Install and authenticate postagent in CI:
--token flagAfter this step, all postagent send commands in the workflow can use $POSTAGENT.VERCEL.API_KEY just like locally.
Phase 2 — Deploy:
Use postagent to create the deployment. Vercel handles the build asynchronously — a simple deployment creation call is sufficient. Status polling is optional and can be added later if the team wants the workflow to wait for the build result.
The deployment request requires two categories of parameters:
teamId, projectId, projectName, etc. Reference these from secrets or env vars.${{ github.sha }}).Use postagent to consult the Vercel deployment API documentation, understand which parameters are required, and assemble the request from static and dynamic values.
Pitfall — gitSource format: The Vercel API docs mark gitSource.type as [const: vercel], but this is misleading. For GitHub repositories, the correct minimal gitSource is:
type — must be "github" (not "vercel")repoId — the numeric GitHub repository ID (not the repo name)ref — the commit SHA to deployUsing type: "vercel" will result in a 500 error. The GitHub repo ID can be obtained via postagent through the GitHub repos API.
Commit and push the workflow file using standard git commands (git add, git commit, git push). Do not use postagent for git operations.
After pushing, the workflow triggers automatically. Verify both sides using postagent:
READY state and produced the expected URL.github/workflows/--token flag using the injected secretvercel.json) or the Git integration is disconnectedpostagent auth for local operations — tokens stay in postagent's credential store--token flag with secrets injection — the token never appears in logspreview target for initial testing before deploying to production