Skip to content

feat(setup github): add --with-plan option for PR preview#1047

Merged
toiroakr merged 4 commits into
mainfrom
feat/plan-action
May 13, 2026
Merged

feat(setup github): add --with-plan option for PR preview#1047
toiroakr merged 4 commits into
mainfrom
feat/plan-action

Conversation

@toiroakr
Copy link
Copy Markdown
Contributor

Summary

Add --with-plan / -p option to setup github command to include a plan job in the generated workflow.

Changes

  • Add plan-job.yml snippet for the plan job
  • Update deploy.workflow.yml to support combined workflow (deploy + plan)
  • Add --with-plan option to the command
  • Workflow triggers on pull_request: branches: [main] for plan, push: branches: [main] for deploy

Usage

tailor-sdk setup github \
  --workspace-name my-app \
  --workspace-region asia-northeast \
  --organization-id org-123 \
  --folder-id folder-456 \
  --with-plan   # Include plan job for PR previews

Generated Workflow

Single workflow file tailor-<workspace-name>.yml with:

  • plan job: Runs on PRs to main, comments dry-run output
  • deploy job: Runs on push to main, deploys to workspace

Dependencies

Requires tailor-platform/actions/plan action:

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

🦋 Changeset detected

Latest commit: a83094d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@tailor-platform/sdk Patch
@tailor-platform/create-sdk Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

⚡ pkg.pr.new

@tailor-platform/sdk

pnpm add https://pkg.pr.new/@tailor-platform/sdk@a83094d
pnpm dlx https://pkg.pr.new/@tailor-platform/sdk@a83094d --help

@tailor-platform/create-sdk

pnpm add https://pkg.pr.new/@tailor-platform/create-sdk@a83094d
pnpm dlx https://pkg.pr.new/@tailor-platform/create-sdk@a83094d my-app

commit: a83094d

@github-actions

This comment has been minimized.

toiroakr and others added 2 commits May 8, 2026 13:24
Embed the SHA and version comment directly in the generated workflow
YAML so Renovate's customManager picks it up, and remove the TS-side
ACTIONS_REF / ACTIONS_VERSION constants.

Also fix the customManager that wasn't actually matching: wrap the
managerFilePatterns in /.../ (Renovate v40+ treats unwrapped values
as globs), add a subpath capture for composite action paths
(tailor-platform/actions/deploy etc.), and set an
autoReplaceStringTemplate that preserves the uses: prefix and subpath.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Merge plan-job.yml into deploy.workflow.yml using marker comments and
strip the section when --with-plan is omitted, instead of injecting a
separate snippet. Simpler control flow and a single source of truth for
the workflow shape.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

Code Metrics Report (packages/sdk)

main (f3674c0) #1047 (b471242) +/-
Coverage 60.9% 60.9% -0.1%
Code to Test Ratio 1:0.4 1:0.4 +0.0
Details
  |                    | main (f3674c0) | #1047 (b471242) |  +/-  |
  |--------------------|----------------|-----------------|-------|
- | Coverage           |          60.9% |           60.9% | -0.1% |
  |   Files            |            358 |             358 |     0 |
  |   Lines            |          12217 |           12225 |    +8 |
+ |   Covered          |           7448 |            7452 |    +4 |
+ | Code to Test Ratio |          1:0.4 |           1:0.4 |  +0.0 |
  |   Code             |          80084 |           80133 |   +49 |
+ |   Test             |          32929 |           32958 |   +29 |

Code coverage of files in pull request scope (69.5% → 66.6%)

Files Coverage +/- Status
packages/sdk/src/cli/commands/setup/github/deploy.workflow.yml 0.0% 0.0% modified
packages/sdk/src/cli/commands/setup/github/github.ts 45.1% -2.9% modified
packages/sdk/src/cli/commands/setup/github/index.ts 50.0% 0.0% modified
packages/sdk/src/cli/commands/setup/github/template-deploy.ts 100.0% 0.0% modified

SDK Configure Bundle Size

main (f3674c0) #1047 (b471242) +/-
configure-index-size 17.78KB 17.78KB 0KB
dependency-chunks-size 33.56KB 33.56KB 0KB
total-bundle-size 51.34KB 51.34KB 0KB

Runtime Performance

main (f3674c0) #1047 (b471242) +/-
Generate Median 2,551ms 2,566ms 15ms
Generate Max 2,733ms 2,656ms -77ms
Apply Build Median 2,605ms 2,594ms -11ms
Apply Build Max 2,628ms 2,618ms -10ms

Type Performance (instantiations)

main (f3674c0) #1047 (b471242) +/-
tailordb-basic 35,130 35,130 0
tailordb-optional 3,841 3,841 0
tailordb-relation 7,428 7,428 0
tailordb-validate 2,566 2,566 0
tailordb-hooks 5,767 5,767 0
tailordb-object 12,136 12,136 0
tailordb-enum 2,462 2,462 0
resolver-basic 9,424 9,424 0
resolver-nested 26,111 26,111 0
resolver-array 18,187 18,187 0
executor-schedule 4,234 4,234 0
executor-webhook 873 873 0
executor-record 8,166 8,166 0
executor-resolver 4,369 4,369 0
executor-operation-function 869 869 0
executor-operation-gql 869 869 0
executor-operation-webhook 888 888 0
executor-operation-workflow 1,714 1,714 0

Reported by octocov

@toiroakr toiroakr marked this pull request as ready for review May 11, 2026 01:08
@toiroakr toiroakr requested a review from remiposo as a code owner May 11, 2026 01:08
@claude
Copy link
Copy Markdown

claude Bot commented May 11, 2026

📖 Docs Consistency Check

✅ No inconsistencies found between documentation and implementation.

Checked areas:

CLI Documentation

  • packages/sdk/docs/cli/setup.md - --with-plan option documented in auto-generated options table (line 75)
  • ✅ Option description matches implementation: "Include plan job for PR previews"
  • ✅ Alias (-p), type (boolean), default (false), and required status (No) all match the command definition

Implementation Verification

  • packages/sdk/src/cli/commands/setup/github/index.ts - Option properly defined with correct alias, description, and default value
  • packages/sdk/src/cli/commands/setup/github/github.ts - withPlan option propagated through SetupGitHubOptions type and setupGitHub() function
  • packages/sdk/src/cli/commands/setup/github/template-deploy.ts - renderDeploy() correctly handles conditional plan job section removal
  • packages/sdk/src/cli/commands/setup/github/deploy.workflow.yml - Template includes properly delimited plan job section with __PLAN_JOB_START__ and __PLAN_JOB_END__ markers

Test Coverage

  • ✅ Tests verify plan job is stripped by default (line 156-163)
  • ✅ Tests verify plan job is included when withPlan: true (line 165-173)
  • ✅ Tests verify setup steps appear in both jobs (line 175-179)
  • ✅ Tests verify working-directory propagates to both jobs (line 181-189)

Workflow Behavior

  • ✅ Generated workflow name changed from Deploy to Tailor Platform (consistent with template)
  • ✅ Workflow file naming changed from deploy-<workspace>.yml to tailor-<workspace>.yml (tested at line 214)
  • ✅ Plan job triggers on pull_request events to main branch
  • ✅ Deploy job triggers on push events to main branch (skips pull requests)
  • ✅ Concurrency group includes workspace name and branch/ref
  • ✅ CLI output includes conditional next steps for setting TAILOR_PLATFORM_WORKSPACE_ID variable when withPlan is true (line 100-104)

Cross-References

  • ✅ No other files in the codebase reference this command that would need updates
  • CLAUDE.md and README.md don't document this command (no updates needed)
  • ✅ No example workflows need updating

@toiroakr toiroakr merged commit d5e8dca into main May 13, 2026
56 checks passed
@toiroakr toiroakr deleted the feat/plan-action branch May 13, 2026 00:40
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