Skip to content

Re-enable deploy-to-staging label workflow (Step 6/6)#27076

Draft
rob-ghost wants to merge 1 commit intomainfrom
feat/version-pinning
Draft

Re-enable deploy-to-staging label workflow (Step 6/6)#27076
rob-ghost wants to merge 1 commit intomainfrom
feat/version-pinning

Conversation

@rob-ghost
Copy link
Copy Markdown
Contributor

@rob-ghost rob-ghost commented Apr 2, 2026

Summary

Re-enables the deploy-to-staging label workflow that was disabled due to admin deploys being global and main merges overwriting targeted server deploys. Both problems are now solved by per-site version pinning (Steps 1-5).

Changes

  • deploy-to-staging.yml: removed false && guard and disabled comments. Added unlabeled and closed event handlers that dispatch to Ghost-Moya to clear version pins and deactivate GitHub deployments.
  • ci.yml: restored deploy-to-staging label detection in the trigger_cd job so PR CI dispatches include deploy=true when the label is present.

How it works now

  1. Add deploy-to-staging label → Ghost CI dispatches to Moya with deploy=true
  2. Moya deploys server to demo.ghost.is and pins both admin + server versions
  3. Subsequent merges to main skip demo.ghost.is (pinned)
  4. Remove label or close PR → Ghost dispatches unpin-staging-sites to Moya → pins cleared

Proposal

https://www.notion.so/ghost/31951439c03081daa133eb0215642202

Merge order

This is Step 6 of 6 — must be merged last, after all infrastructure is deployed to staging.

# Repo PR Deploy via
1 Daisy.js TryGhost/Daisy.js#1993 Shipit (Jenkins)
2 Zuul TryGhost/Zuul#1036 Shipit (Jenkins)
3+5 Ghost-Moya TryGhost/Ghost-Moya#209 GitHub Actions (merge)
4 BlackPearl TryGhost/BlackPearl#1830 SaltStack (manual)
Ghost-Rollout TryGhost/Ghost-Rollout#98 Docker image rebuild
6 Ghost this PR GitHub Actions (merge)

ref: https://linear.app/ghost/issue/BER-3516/ghost-re-enable-deploy-to-staging-label-workflow

Removed the false guard and disabled comments. Added unlabeled/closed
handlers that dispatch to Ghost-Moya to clear version pins and
deactivate GitHub deployments.

refs https://www.notion.so/ghost/31951439c03081daa133eb0215642202
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main objective: re-enabling the deploy-to-staging label workflow, with the step number for context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly explains the purpose of re-enabling the deploy-to-staging workflow, documents the specific changes made to both workflow files, provides a step-by-step explanation of how the workflow will function, and includes important context about merge ordering and related infrastructure changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/version-pinning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 2, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/deploy-to-staging.yml:
- Around line 158-161: The workflow YAML contains a hardcoded staging site ID
"303000" without explanation. Add an inline comment next to the "site_ids":
"303000" line to clarify that this value is the staging site ID. This will help
future maintainers understand the purpose of this constant in the
deploy-to-staging job.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8318d3f1-6a54-48f5-b6fc-dbec32ccc8fa

📥 Commits

Reviewing files that changed from the base of the PR and between 927d4da and 8fa5706.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • .github/workflows/deploy-to-staging.yml

Comment on lines +158 to +161
client-payload: >-
{
"site_ids": "303000",
"pr_number": "${{ github.event.pull_request.number }}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for references to site_ids or 303000 in the repository to understand context
rg -n '303000' --type yaml --type json
rg -nP 'site_ids?\s*[=:]' --type yaml -C2

Repository: TryGhost/Ghost

Length of output: 40


🏁 Script executed:

# Search for references to unpin-staging-sites event and Ghost-Moya
rg -n 'unpin-staging-sites' 
rg -n 'Ghost-Moya\|ghost-moya'
rg -n 'site_ids\|site.id' 

# Check if there's documentation about the site IDs
rg -in 'staging.*site.*id\|site.*303000'

# Get the full deploy-to-staging.yml file to understand context
fd 'deploy-to-staging.yml' --exec cat -n {}

Repository: TryGhost/Ghost

Length of output: 40


🏁 Script executed:

# First, verify the file exists and get its location
fd 'deploy-to-staging.yml'

# Try to read the specific file mentioned in the review
cat -n .github/workflows/deploy-to-staging.yml | sed -n '125,165p'

# Also search for any comments or documentation in the workflow file
cat -n .github/workflows/deploy-to-staging.yml | grep -A5 -B5 'site_ids\|unpin-staging\|303000'

Repository: TryGhost/Ghost

Length of output: 2160


🏁 Script executed:

# Search for any documentation or comments about the staging site or site_ids
rg -n 'site.id\|site_id\|staging.*site\|303' .github/workflows/

# Look for any README or documentation files that might explain the site configuration
fd -e md -e txt -e json | xargs rg -l 'staging\|site.*id' 2>/dev/null | head -20

# Check if there are any comments in the workflow file around this section
cat -n .github/workflows/deploy-to-staging.yml | sed -n '100,125p'

# Check the end of the file for any documentation
tail -50 .github/workflows/deploy-to-staging.yml | cat -n

Repository: TryGhost/Ghost

Length of output: 3460


Add a comment explaining the hardcoded staging site ID.

The site_ids: "303000" is a magic constant with no explanation. Add an inline comment (e.g., # Staging site ID) to clarify what this ID represents for future maintainers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/deploy-to-staging.yml around lines 158 - 161, The workflow
YAML contains a hardcoded staging site ID "303000" without explanation. Add an
inline comment next to the "site_ids": "303000" line to clarify that this value
is the staging site ID. This will help future maintainers understand the purpose
of this constant in the deploy-to-staging job.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.20%. Comparing base (041b2ec) to head (8fa5706).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #27076   +/-   ##
=======================================
  Coverage   73.19%   73.20%           
=======================================
  Files        1531     1531           
  Lines      121796   121796           
  Branches    14695    14695           
=======================================
+ Hits        89154    89158    +4     
+ Misses      31646    31623   -23     
- Partials      996     1015   +19     
Flag Coverage Δ
admin-tests 54.41% <ø> (+0.02%) ⬆️
e2e-tests 73.20% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant