7.2 KiB
Executable File
7.2 KiB
Executable File
model, allowed-tools, argument-hint, description
| model | allowed-tools | argument-hint | description | |
|---|---|---|---|---|
| claude-haiku-4-5-20251001 | SlashCommand, Bash(git:*), mcp__ado__repo_get_pull_request_by_id, mcp__ado__repo_list_pull_requests_by_repo_or_project |
|
Complete deployment workflow - commit, PR to staging, review, then staging to develop |
Complete Deployment Workflow
Automates the full deployment workflow with integrated PR review:
- Commit feature changes and create PR to staging
- Automatically review the PR for quality and standards
- Fix any issues identified in review (with iteration loop)
- After PR is approved and merged, create PR from staging to develop
What This Does
- Calls
/pr-feature-to-stagingto commit and create feature → staging PR - Calls
/pr-reviewto automatically review the PR - If review identifies issues → calls
/pr-fix-pr-reviewand loops back to review - If review passes → waits for user to merge staging PR
- Calls
/pr-staging-to-developto create staging → develop PR
Implementation Logic
Step 1: Create Feature PR to Staging
Use SlashCommand tool to execute:
/pr-feature-to-staging $ARGUMENTS
Expected Output:
- PR URL and PR ID
- Work item comments added
- Source and target branches confirmed
Extract from output:
- PR ID (needed for review step)
- PR number (for user reference)
Step 2: Automated PR Review
Use SlashCommand tool to execute:
/pr-review [PR_ID]
The review will evaluate:
- Code quality and maintainability
- PySpark best practices
- ETL pattern compliance
- Standards compliance from
.claude/rules/python_rules.md - DevOps considerations
- Merge conflicts
Review Outcomes:
Outcome A: Review Passes (PR Approved)
Review output will indicate:
- "PR approved and set to auto-complete"
- No active review comments requiring changes
- All quality gates passed
Action: Proceed to Step 4
Outcome B: Review Requires Changes
Review output will indicate:
- Active review comments with specific issues
- Quality standards not met
- Files requiring modifications
Action: Proceed to Step 3
Step 3: Fix Review Issues (if needed)
Only execute if Step 2 identified issues
Use SlashCommand tool to execute:
/pr-fix-pr-review [PR_ID]
This will:
- Retrieve all active review comments
- Make code changes to address feedback
- Run quality gates (syntax, lint, format)
- Commit fixes and push to feature branch
- Reply to review threads
- Update the PR automatically
After fixes are applied:
- Loop back to Step 2 to re-review
- Continue iterating until review passes
Iteration Logic:
LOOP while review has active issues:
1. /pr-fix-pr-review [PR_ID]
2. /pr-review [PR_ID]
3. Check review outcome
4. If approved → exit loop
5. If still has issues → continue loop
END LOOP
Step 4: Wait for Staging PR Merge
After PR review passes and is approved, inform user:
✅ PR Review Passed - PR Approved and Ready
PR #[PR_ID] has been reviewed and approved with auto-complete enabled.
Review Summary:
- Code quality: ✓ Passed
- PySpark best practices: ✓ Passed
- ETL patterns: ✓ Passed
- Standards compliance: ✓ Passed
- No merge conflicts
Next Steps:
1. The PR will auto-merge when all policies are satisfied
2. Once merged to staging, I'll create the staging → develop PR
Would you like me to:
a) Create the staging → develop PR now (if staging merge is complete)
b) Wait for you to confirm the staging merge
c) Check the PR status
Enter choice (a/b/c):
User Responses:
- a: Immediately proceed to Step 5
- b: Wait for user confirmation, then proceed to Step 5
- c: Use
mcp__ado__repo_get_pull_request_by_idto check if PR is merged, then guide user
Step 5: Create Staging to Develop PR
Use SlashCommand tool to execute:
/pr-staging-to-develop
This will:
- Create PR: staging → develop
- Handle any merge conflicts
- Return PR URL for tracking
Final Output:
🚀 Deployment Workflow Complete
Feature → Staging:
- PR #[PR_ID] - Reviewed and Merged ✓
Staging → Develop:
- PR #[NEW_PR_ID] - Created and Ready for Review
- URL: [PR_URL]
Summary:
1. Feature PR created and reviewed
2. All quality gates passed
3. PR approved and merged to staging
4. Staging PR created for develop
The workflow is complete. The staging → develop PR is now ready for final review and deployment.
Example Usage
Full Workflow with Work Item
/deploy-workflow "feat(gold): add X_MG_Offender linkage table #45497"
This will:
- Create commit on feature branch
- Create PR: feature → staging
- Comment on work item #45497
- Automatically review PR for quality
- Fix any issues identified (with iteration)
- Wait for staging PR merge
- Create PR: staging → develop
Full Workflow Without Work Item
/deploy-workflow "refactor: optimise session management"
This will:
- Create commit on feature branch
- Create PR: feature → staging
- Automatically review PR
- Fix any issues (iterative)
- Wait for merge confirmation
- Create staging → develop PR
Review Iteration Example
Scenario: Review finds 3 issues in the initial PR
Step 1: /pr-feature-to-staging "feat: add new table"
→ PR #5678 created
Step 2: /pr-review 5678
→ Found 3 issues:
- Missing type hints in function
- Line exceeds 240 characters
- Missing @synapse_error_print_handler decorator
Step 3: /pr-fix-pr-review 5678
→ Fixed all 3 issues
→ Committed and pushed
→ PR updated
Step 2 (again): /pr-review 5678
→ All issues resolved
→ PR approved ✓
Step 4: Wait for merge confirmation
Step 5: /pr-staging-to-develop
→ PR #5679 created (staging → develop)
Complete!
Error Handling
PR Creation Fails
- Display error from
/pr-feature-to-staging - Guide user to resolve (branch validation, git issues)
- Do not proceed to review step
Review Cannot Complete
- Display specific blocker (merge conflicts, missing files)
- Guide user to manual resolution
- Offer to retry review after fix
Fix PR Review Fails
- Display specific errors (quality gates, git issues)
- Offer manual intervention option
- Allow user to fix locally and skip to next step
Staging PR Already Exists
- Use
mcp__ado__repo_list_pull_requests_by_repo_or_projectto check existing PRs - Inform user of existing PR
- Ask if they want to create anyway or use existing
Notes
- Automated Review: Quality gates are enforced automatically
- Iterative Fixes: Will loop through fix → review until approved
- Semi-Automated Merge: User must confirm staging merge before final PR
- Work Item Tracking: Automatic comments on linked work items
- Quality First: Won't proceed if review fails and can't auto-fix
- Graceful Degradation: Offers manual intervention at each step if automatisation fails
Quality Gates Enforced
The integrated /pr-review checks:
- Code quality (type hints, line length, formatting)
- PySpark best practices (DataFrame ops, logging, session mgmt)
- ETL pattern compliance (class structure, decorators)
- Standards from
.claude/rules/python_rules.md - No merge conflicts
- Proper error handling
All must pass before proceeding to staging → develop PR.