Delete a staging branch to free the shared Pantheon staging slot.
- External review is complete and the staging branch is no longer needed.
- A PR was closed or merged and the staging slot should be cleared for the next deployment.
/stage-teardown {pr-number-or-branch}
Examples:
/stage-teardown 6701/stage-teardown docs-update-jira-skill-fields
- If input is numeric: staging branch is
staging/pr-{number}. - If input is a branch name: look up the PR number with
gh pr list --head {branch} --json number --jq '.[0].number', then usestaging/pr-{number}.
git ls-remote --heads origin refs/heads/staging/pr-{number}If the branch is not found, inform the user and exit — nothing to delete.
Slack notifications require $WEBOPS_SLACK_URL to be exported in the local environment. Check first:
if [ -z "$WEBOPS_SLACK_URL" ]; then
echo "⚠️ WEBOPS_SLACK_URL not set — skipping Slack notification."
fiIf set, post to #web-ops:
curl -X POST "$WEBOPS_SLACK_URL" \
-H 'Content-Type: application/json' \
-d '{
"text": "🗑️ Staging environment torn down",
"blocks": [{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Staging environment removed*\n• Branch: staging/pr-{number}\n• Note: previous deployment remains live at the staging URL until the next deployment overwrites it"
}
}]
}'git push origin --delete staging/pr-{number}Post a comment on the PR confirming the staging branch was deleted and noting that the staging URL may still serve the old build until the next deployment.