Commit 4076535
feat: add vercel-build action input for local Vercel build step (#361)
* docs(track): add auto-vercel-build-20260430
Add track for opt-in vercel-build action input that runs vercel pull and
vercel build locally before deployment, then routes through the existing
prebuilt deploy path.
Refs #360
* chore(track): start auto-vercel-build-20260430 implementation
Refs #360
* feat(config): add vercel-build input with mutual-exclusivity check
Add a new boolean action input `vercel-build` that opts into running
`vercel pull` + `vercel build` locally before deployment. When combined
with `prebuilt: true`, the action fails fast at config parse time
since the two flags are conceptually mutually exclusive.
T001+T002+T003 of auto-vercel-build-20260430.
Refs #360
* feat(vercel-build): add BuildFailedError, pull/build runners, orchestrator
Add new module src/vercel-build.ts:
- BuildFailedError with stderr-tail capture (last 20 lines, fallback to
stdout when stderr is empty)
- runVercelPull(config): `vercel pull --yes --environment=<target>`
- runVercelBuild(config): `vercel build [--prod]` with buildEnv merged
into the exec environment
- runBuildStep(config): pull → build sequencing, returns
{ prebuilt: true, vercelOutputDir } so callers can route through the
existing prebuilt deploy path
T004–T009 of auto-vercel-build-20260430.
Refs #360
* feat(index): wire vercel-build runner into run() with failure comments
Wire runBuildStep into run() before deployment when vercel-build: true.
On success, mutate the config to set prebuilt=true and vercelOutputDir
so the existing API client uploads the produced .vercel/output.
On BuildFailedError, post a build-failure comment (PR or commit) with
the captured stderr tail (last 20 lines), then rethrow so the action
exits non-zero.
Also export run() and guard the top-level invocation behind
`process.env.VITEST` so tests can drive run() without triggering the
module-level fire-and-forget call.
T010-T013 of auto-vercel-build-20260430.
Refs #360
* feat: add vercel-build integration test, README, dist rebuild
- Integration test (src/__integration__/vercel-build.test.ts):
3 tests covering runBuildStep output, end-to-end deploy via emulator
with the prebuilt path, and fail-fast on pull error.
- README: `vercel-build` input row in the API inputs table, plus a new
"Method 4 - Build inside the action" section with a workflow example
and notes on mutual exclusivity, build-env, target=production, and
failure-comment behavior.
- dist/: regenerated via @vercel/ncc.
Coverage: vercel-build.ts 94.39% (NFR-4 target >80%), suite 272 tests
passing.
T014-T016 of auto-vercel-build-20260430.
Refs #360
* fix(vercel-build): pass token via VERCEL_TOKEN env, escape fenced blocks
Address code-review findings on PR #361:
- Critical (security): Stop passing the Vercel token via `-t <token>` argv,
which @actions/exec echoes verbatim to stdout via toolrunner's
[command]... line before the runner's secret mask can claim it. Pass
the token through the VERCEL_TOKEN environment variable instead — the
documented non-interactive auth path per the Vercel CLI source
(packages/cli/src/commands/build/index.ts:309). Also set silent: true
on the ExecOptions to suppress the [command] echo entirely.
- Important (security): `stderrTail` is interpolated into a Markdown
fenced code block in PR/commit comments. Untrusted build output
containing triple-backticks could close the fence and inject Markdown.
Escape any run of 3+ backticks before interpolation.
- Important (tests): Add three orchestration tests in run-build.test.ts:
1. Asserts createBuildFailureCommentOnPullRequest is called with
the BuildFailedError's exitCode and stderrTail (AC-4 wiring)
2. Asserts createBuildFailureCommentOnCommit is called for push
events instead of the PR helper
3. Asserts no failure comment is posted when github-comment is false
- Add 4 vercel-build.test.ts tests asserting the token is NOT in argv
and IS in env, plus that exec runs with silent: true.
dist/ rebuilt. Suite: 280 tests passing (was 272).
Refs #360
* fix(vercel-build): honor vercel-output-dir via --output flag
Previously, when a user combined `vercel-build: true` with a custom
`vercel-output-dir`, the build wrote to the default `.vercel/output`
while the prebuilt deploy looked at `config.vercelOutputDir` —
silently mismatched. The user's vercel-output-dir was effectively
ignored during the build.
Fix:
- runVercelBuild now passes `--output <dir>` to `vercel build`
whenever `config.vercelOutputDir` is set (relative paths resolved
against working-directory; absolute paths used as-is).
- runBuildStep now returns the user's `vercelOutputDir` (resolved)
instead of always defaulting to `<workingDir>/.vercel/output`,
so the deploy reads from the same place the build wrote to.
- Spec FR-2 + new AC-7 + plan architecture diagram updated to reflect
`[--output <dir>]` and the VERCEL_TOKEN env transport.
- README documents both the env-var auth path and the --output
passthrough.
- 5 new unit tests covering --output omission, absolute path, and
relative-path resolution.
Addresses gemini-code-assist[bot] review threads on PR #361.
Refs #360
* chore(track): auto-vercel-build-20260430 PR 제출 완료
- Move track active/ → completed/
- Update metadata: status=review, updated_at, pr=#361
- Update tracks.jsonl: section=completed, phase=finalize
- Sync to product-specs: SPEC-001 deployment/vercel-build.md (created)
- Append retrospective + tech-debt items (TD-001 vercel-cli token transport, TD-002 e2e gap)
Refs #360
* chore: apply AI code review suggestions (round 2)
Apply 5 review suggestions from copilot + cubic-dev-ai on PR #361:
- src/vercel-build.ts: bound captured stdout/stderr to ~64 KB per stream
(appendBounded helper). Long vercel build runs no longer risk runner
OOM; the stderrTail tail-line behavior is preserved.
- src/index.ts: replace negative `!process.env.VITEST` auto-invoke
guard with positive `process.env.GITHUB_ACTIONS === 'true'` check.
The previous guard would silently disable the action in any workflow
that happens to set VITEST. GITHUB_ACTIONS is the canonical
runner-set sentinel.
- src/config.ts: add fail-fast mutex between `vercel-build: true` and
non-empty `vercel-args`. Without it, the action would build locally
via the prebuilt path then route the deploy through the CLI path,
silently ignoring the local build output.
- src/github-comments.ts: change build-failure comment wording from
'this pull request' to 'this workflow run' so the same body works
for both PR comments and commit comments (push events).
- README.md: fix broken `vercel-build` anchor link to use the actual
GitHub-rendered slug (`#method-4---build-inside-the-action-vercel-build`).
3 new tests: vercel-args mutex (positive + whitespace edge case),
huge-stderr bounded buffer.
Suite: 305 tests passing (was 302). Lint clean, tsc clean. dist/
rebuilt.
Refs #360
* fix(tests): clear GITHUB_ACTIONS env in vitest unit project to prevent auto-invocation on import
Agent-Logs-Url: https://github.com/amondnet/vercel-action/sessions/e840b930-a078-4381-91dc-06dc24402e36
Co-authored-by: amondnet <1964421+amondnet@users.noreply.github.com>
* chore(dist): rebuild bundle to match src/index.ts comment update
The check-dist CI step regenerates dist/ and fails if it differs from
the committed bundle. Commit 45de99c updated the auto-invoke guard
comment in src/index.ts and added a vitest env override but did not
rebuild dist/. Regenerate via @vercel/ncc so the committed bundle
matches source.
Refs #360
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: amondnet <1964421+amondnet@users.noreply.github.com>1 parent 31671aa commit 4076535
26 files changed
Lines changed: 2133 additions & 29 deletions
File tree
- .please/docs
- product-specs
- deployment
- tracks
- completed/auto-vercel-build-20260430
- dist
- src
- __integration__
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments