DOCS-1629 - Add /stage-deploy and /review-deploy commands for two staging environments - #6704
Conversation
|
@kimsauce FYI this is a proposal for adding a claude code skill to |
Simplified approach using existing staging infrastructure:
- Reuses existing workflow_deploy-to-pantheon-staging.yml
- Deploys to single shared helpdocs multidev environment
- Creates/pushes staging/pr-{number} branches to trigger deployment
- No new workflows or Pantheon changes required
Commands:
- /stage-deploy {pr-number-or-branch} - Push staging branch to deploy
- /stage-teardown {pr-number-or-branch} - Delete staging branch
URL: https://helpdocs-sumo-logic.pantheonsite.io/help/ (shared, single slot)
Limitations:
- Only one PR can be staged at a time (team coordination required)
- Manual cleanup of staging branches needed
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
5190f97 to
2f58974
Compare
Enhancements: - Slack notifications to #web-ops on deploy start and teardown - Include article preview URL in Slack message (detects from PR files) - Conflict detection: checks for existing staging/pr-* branches - Shows who created conflicting deployment and preview URL - Prompts user to continue/overwrite or cancel - Uses same WEBOPS_SLACK_URL as existing Pantheon workflows Coordination improvements: - Team always aware of staging changes via Slack - Direct link to article being previewed - Prevents accidental overwrites with conflict warnings - Identifies conflicting PR author for coordination
Coordination Features Added ✅Added automatic coordination to prevent conflicts and keep team informed: 🔔 Slack NotificationsPosts to #web-ops (same channel as existing Pantheon workflows): On deploy: On teardown:
|
There was a problem hiding this comment.
This is a great idea, Mark! Had some feedback -
- I think this should be a command, not a skill. Skills in
.claude/skills/are passive reference guides (sumo-style, docusaurus, pr-template-guide) that get applied automatically. An explicitly invoked/stage-deploycommand belongs at.claude/commands/stage-deploy.md. /stage-teardownhas no corresponding file. Whether this moves to.claude/commands/or stays as a skill, teardown needs its own file. There's no.claude/commands/stage-teardown.mdor.claude/skills/stage-teardown/SKILL.md— so/stage-teardownas a slash command won't route anywhere.- Update CLAUDE.md.
/stage-deployand/stage-teardownaren't listed in the slash commands section of CLAUDE.md. New commands need to be registered there.
- Move stage-deploy from .claude/skills/ subdirectory to .claude/commands/stage-deploy.md to match command convention - Create .claude/commands/stage-teardown.md as a standalone command - Register both commands in CLAUDE.md slash commands section - Replace git branch -f with direct refspec push to avoid clobbering local branch state - Treat $WEBOPS_SLACK_URL as optional with graceful skip when not set locally Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Good catches, all three fixed:
|
…kflow-clean # Conflicts: # CLAUDE.md
…nd staging env Adds companion commands to /stage-deploy and /stage-teardown targeting the docs-review environment introduced in PR #7014 (review/** branches), so quick article-level review can use a dedicated slot separate from the helpdocs staging environment reserved for UX/UI feature previews. Depends on PR #6704 (this branch) and PR #7014 merging before it is functional.
|
Added Merge note: |
|
This is a great follow-up, @mafsumo ! The command/environment split is clean and the file structure matches the pattern we settled on for /stage-deploy. A few things before I approve:
Everything else (conflict detection, article URL detection, the optional Slack pattern) is consistent with what's already approved on /stage-deploy and /stage-teardown. Once the above are addressed I'm good to re-approve. |
|
Thanks for the follow-up review, Kim. Addressing each point:
Also dropped the Slack notification step from all four commands (/stage-deploy, /stage-teardown, /review-deploy, /review-teardown). Claude Code running locally has no way to read WEBOPS_SLACK_URL, or any Slack bot token, out of GitHub Actions secrets. They're write-only once set, with no CLI or API path to retrieve them, so I'm scoping that out. The PR comment step already in each command covers coordination instead, and the workflows' own build success/failure Slack ping is untouched. |
Slack notifications are out of scope: Claude Code running locally has no way to read WEBOPS_SLACK_URL, or any Slack bot token, out of GitHub Actions secrets (write-only once set, no CLI/API path to retrieve them). Removed the curl-based notification step from /stage-deploy, /stage-teardown, /review-deploy, and /review-teardown. The existing PR comment step in each command covers coordination instead; the workflows' own build success/failure Slack ping is unaffected. Also updates stage-deploy.md's Purpose and "When to use" sections to match the UX/UI and feature-staging framing already used in CLAUDE.md and review-deploy.md's cross-reference, per Kim's review feedback.
…' into feat/stage-deploy-workflow-clean
|
Review Verified Found two real defects (present in both the staging and review pair, since the files are near-duplicates):
One lower-confidence gap:
|
…icts
- Add --force to the staging/review branch push. The target ref already
exists from the previous deploy, and the PR branch may have been
amended, rebased, or force-pushed since then, so a plain push can be
rejected as non-fast-forward.
- Actually implement the "posts a heads-up comment on PR #{n}" promise
in the conflict prompt: the displaced PR now gets its own comment,
separate from the Step 6 comment on the PR being deployed.
- Handle multiple stale staging/review branches in the conflict
template instead of assuming there's only ever one.
|
Thanks for catching these, Kim. Good review. Fixed both defects and the lower-confidence gap in stage-deploy.md and review-deploy.md:
Pushed as 4a316ee. |
…kflow-clean # Conflicts: # CLAUDE.md
- Fetch refs/pull/{number}/head instead of {pr-branch} for the deploy
push. Fork-based contributor PRs have their branch on the fork's
remote, not origin, so fetching by branch name fails for them.
GitHub maintains refs/pull/{number}/head on origin for every PR
regardless of where the branch actually lives.
- Exclude the PR being redeployed from its own conflict scan, so
redeploying after new commits doesn't treat the prior deployment as
a conflict and post an "overwritten by PR #N" comment onto PR #N.
- Filter out files with changeType == REMOVED before generating
article preview links, so a deleted doc doesn't get a preview link
that 404s.
Same three fixes in both stage-deploy.md and review-deploy.md.
|
@kimsauce , addressing your three new findings from the latest review. Fixed all three in both stage-deploy.md and review-deploy.md, pushed as 6398a72.
Also merged main into this branch to pick up #6872, the AGENTS.md refactor. CLAUDE.md is now the one-line @AGENTS.md pointer, and I ported the Staging quick-reference bullet, key distinctions, and command table into AGENTS.md's Claude Code specifics section, matching the existing pattern for the other command categories there. This should cover everything from your last two rounds of review. Can you take a final look before merging? |
…kflow-clean # Conflicts: # AGENTS.md
|
Merged in three more AGENTS.md changes from main (#7056, #7049, #7046) and resolved the conflicts, pushed as 15568a5. Those commits removed the "Key distinctions" bullet block, dropped the stale No changes needed to the command files themselves, this was all AGENTS.md structure. |
Purpose of this pull request
Adds four Claude Code commands that deploy PR branches to Pantheon for external review, split across two dedicated environments:
/stage-deployand/stage-teardown— the existinghelpdocsenvironment (staging/**branches), now scoped to UX/UI and site-wide feature previews./review-deployand/review-teardown— thedocs-reviewenvironment (review/**branches) added in add workflow for second staging environment #7014, scoped to quick, temporary article-level review.Both pairs reuse existing infrastructure. This PR adds no new workflow files;
/review-deployand/review-teardowndepend on thedocs-reviewworkflow from #7014, which has already merged.How it works
Staging (UX/UI, feature work):
/stage-deploy {pr-number}pushes astaging/pr-{number}branch.workflow_deploy-to-pantheon-staging.ymltriggers automatically.https://helpdocs-sumo-logic.pantheonsite.io/help/./stage-teardown {pr-number}deletes the staging branch.Review (article-level, ad hoc):
/review-deploy {pr-number}pushes areview/pr-{number}branch.workflow_deploy-to-pantheon-review.ymltriggers automatically.https://docs-review-sumo-logic.pantheonsite.io/help/./review-teardown {pr-number}deletes the review branch.What's included
.claude/commands/stage-deploy.md,.claude/commands/stage-teardown.md.claude/commands/review-deploy.md,.claude/commands/review-teardown.mdKey features
docs/*.mdpaths into a direct preview link.Conflict detection
Checks for existing
staging/pr-*orreview/pr-*branches and shows:Article URL detection
docs/path/to/article.md→/docs/path/to/article/Out of scope
Slack notifications were dropped from this PR. Claude Code running locally has no way to read
WEBOPS_SLACK_URL, or any Slack bot token, out of GitHub Actions secrets — they're write-only once set, with no CLI or API path to retrieve them. The PR comment step covers coordination instead. A workflow-level redesign (posting from within GitHub Actions, which does have secret access) is a possible follow-up, not part of this PR.Limitations
/stage-teardownor/review-teardown.Select the type of change
Ticket (if applicable)
https://sumologic.atlassian.net/browse/DOCS-1629
Testing
After merge, test staging:
/stage-deploy {test-pr-number}Verify:
git ls-remote --heads origin 'refs/heads/staging/pr-*')Then run
/stage-teardown {test-pr-number}and confirm the branch is deleted and the PR comment reflects it.Repeat with
/review-deploy {test-pr-number}and/review-teardown {test-pr-number}againsthttps://docs-review-sumo-logic.pantheonsite.io/help/.