Skip to content

teach deploy: port safety & DX enhancements from quick-deploy.sh #362

@Data-Wise

Description

@Data-Wise

Summary

Port 4 battle-tested safety and DX features from STAT-545's quick-deploy.sh into teach deploy. These are additive improvements — no breaking changes on the happy path. CI mode remains fully non-interactive.

Enhancements

1. Trap Handler for Branch Safety

trap "git checkout '$draft_branch'" EXIT INT TERM in both direct merge and PR modes. Guarantees return to draft branch on any error/signal instead of relying on manual checkout in each error path.

2. GitHub Actions Monitoring Link

Add Actions: line to the deploy summary box, showing https://github.com/<owner>/<repo>/actions. Extracted from remote.origin.url. Skipped for non-GitHub remotes.

3. Pre-Commit Hook Failure Recovery

When git commit fails during deploy (likely pre-commit hook), show actionable 3-option recovery:

  1. Fix issues, re-run teach deploy
  2. Skip validation: QUARTO_PRE_COMMIT_RENDER=0 teach deploy ...
  3. Force commit: git commit --no-verify -m "message"

4. Uncommitted Changes Prompt (Direct Mode)

Instead of blocking with "working tree dirty", prompt to commit with a smart message. CI mode still fails fast.

Acceptance Criteria

  • Trap handler returns to draft branch on any error/signal in both modes
  • Deploy summary box includes GitHub Actions URL
  • Pre-commit hook failures show actionable recovery message
  • teach deploy -d with uncommitted changes prompts to commit
  • --ci mode: uncommitted changes fail, hook failures exit non-zero
  • All existing tests pass unchanged
  • New tests cover trap, hook failure, uncommitted prompt paths

Spec

See docs/specs/SPEC-teach-deploy-safety-2026-02-08.md on dev branch.

Version Target

v6.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions