Skip to content

Conversation

@majd-shopify
Copy link

@majd-shopify majd-shopify commented Jan 9, 2026

Adds shopify-dev preview automation workflow

WHY are these changes introduced?

Part of https://github.com/Shopify/shopify-dev/issues/66722

We need to add a workflow in Hydrogen that detects changes to gen docs files. If there are any, and the base branch name adheres to the config of gendocs in shopify dev, it will dispatch a shopify-dev workflow which then grabs those changes, and creates a new branch in shopify-dev with those changes in them.

Additionally this workflow will only run for authorized shopify org authors

WHAT is this pull request doing?

Adds the workflow mentioned above!

Here is a link of the workflow running https://github.com/Shopify/hydrogen/actions/runs/20859038193/job/59933554739?pr=3356 however, the workflow it's trying to dispatch is not merged to main yet in shopify-dev

This change will need to go to main and synced across all branches. But currently it is on this branch for testing purposes. Base will change to main once approved and done.

Workflow diagram:

┌─────────────────────────────────────────────────────────────────────────────┐
│                              TRIGGER                                         │
│  pull_request: [opened, synchronize, reopened, ready_for_review]            │
│  paths:                                                                      │
│    - packages/hydrogen/docs/generated/generated_docs_data.json              │
│    - packages/hydrogen-react/docs/generated/generated_docs_data.json        │
│    - packages/hydrogen/docs/generated/generated_static_pages.json           │
│    - packages/hydrogen-react/docs/generated/generated_static_pages.json     │
└─────────────────────────────────────────────────────────────────────────────┘
                                      │
                                      ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│                         CONCURRENCY CONTROL                                  │
│  group: shopify-dev-docs-sync-${{ github.head_ref }}                        │
│  cancel-in-progress: true                                                    │
│  ─────────────────────────────────────────────────────────────────────────  │
│  → Multiple pushes to same PR branch? Only latest run continues.            │
└─────────────────────────────────────────────────────────────────────────────┘
                                      │
                                      ▼
                    ┌─────────────────────────────────┐
                    │  repository_owner == 'shopify'? │
                    └─────────────────────────────────┘
                           │                │
                          NO               YES
                           │                │
                           ▼                ▼
                  ┌──────────────┐    ┌───────────────────────────────────────┐
                  │ JOB SKIPPED  │    │  Step 1: Check base branch pattern    │
                  │ (fork/other) │    │  ────────────────────────────────────  │
                  └──────────────┘    │  Regex: ^[0-9]{4}-[0-9]{2}$           │
                                      │  Examples: 2025-07 ✓  main ✗          │
                                      └───────────────────────────────────────┘
                                                        │
                                        ┌───────────────┴───────────────┐
                                        │                               │
                                   matches=false                   matches=true
                                        │                               │
                                        ▼                               ▼
                          ┌───────────────────────┐    ┌───────────────────────────────────┐
                          │  Steps 2,3,4 SKIPPED  │    │  Step 2: Checkout repository      │
                          │  Job Status: SUCCESS  │    │  ───────────────────────────────  │
                          │  (nothing to do)      │    │  fetch-depth: 0 (full history)   │
                          └───────────────────────┘    └───────────────────────────────────┘
                                                                        │
                                                                        ▼
                                      ┌───────────────────────────────────────────────────┐
                                      │  Step 3: Get changed files                        │
                                      │  ───────────────────────────────────────────────  │
                                      │  git diff $BASE_SHA...$HEAD_SHA                   │
                                      │  Filter: only our 4 monitored files               │
                                      │  Output: JSON array of changed files              │
                                      └───────────────────────────────────────────────────┘
                                                        │
                                        ┌───────────────┴───────────────┐
                                        │                               │
                                 has_changes=false               has_changes=true
                                        │                               │
                                        ▼                               ▼
                          ┌───────────────────────┐    ┌───────────────────────────────────┐
                          │  Step 4 SKIPPED       │    │  Step 4: Dispatch to shopify-dev  │
                          │  Job Status: SUCCESS  │    │  ───────────────────────────────  │
                          │  (no relevant changes)│    │  POST: repository_dispatch        │
                          └───────────────────────┘    │  event_type: templated-api-docs-  │
                                                       │              sync                 │
                                                       └───────────────────────────────────┘
                                                                        │
                                                        ┌───────────────┴───────────────┐
                                                        │                               │
                                                   HTTP 2xx                        HTTP 4xx/5xx
                                                        │                               │
                                                        ▼                               ▼
                                          ┌───────────────────────┐    ┌───────────────────────┐
                                          │  Job Status: SUCCESS  │    │  Job Status: FAILURE  │
                                          │  Dispatch sent! ✓     │    │  Error logged         │
                                          └───────────────────────┘    └───────────────────────┘

HOW to test your changes?

Review https://github.com/Shopify/hydrogen/actions/runs/20859038193/job/59933554739?pr=3356

Post-merge steps

This just needs to be in main, nothing else.

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@shopify
Copy link
Contributor

shopify bot commented Jan 9, 2026

Oxygen deployed a preview of your feat/add-shopify-dev-preview-automation-workflow branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
metaobjects ✅ Successful (Logs) Preview deployment Inspect deployment January 9, 2026 8:21 PM
custom-cart-method ✅ Successful (Logs) Preview deployment Inspect deployment January 9, 2026 8:21 PM
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment January 9, 2026 8:21 PM
third-party-queries-caching ✅ Successful (Logs) Preview deployment Inspect deployment January 9, 2026 8:21 PM

Learn more about Hydrogen's GitHub integration.

@kdaviduik kdaviduik force-pushed the 2025-05 branch 3 times, most recently from 0b3cf8b to 3d66720 Compare January 13, 2026 23:38
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