Skip to content

Add path filtering to Shopify theme workflows#3

Merged
jonathanmoore merged 1 commit into
mainfrom
workflow-path-filtering
Apr 9, 2026
Merged

Add path filtering to Shopify theme workflows#3
jonathanmoore merged 1 commit into
mainfrom
workflow-path-filtering

Conversation

@jonathanmoore
Copy link
Copy Markdown
Owner

Summary

Optimizes GitHub Actions workflows by adding path filtering to prevent unnecessary CI runs and Shopify theme creation for docs-only or non-theme changes.

The Problem

Currently, both pr-preview.yml and deploy.yml run on EVERY change, including:

  • Docs-only updates
  • README changes
  • Script modifications

This wastes CI time and creates unnecessary Shopify preview themes.

The Solution

Add paths filters to both workflows so they only run when theme files actually change.

Changes

.github/workflows/pr-preview.yml

  • Added paths filter to pull_request trigger
  • Only runs when theme-related files change

.github/workflows/deploy.yml

  • Added paths filter to push trigger
  • workflow_dispatch remains unrestricted for manual deploys

Path Filters Applied

Both workflows now only trigger when these files change:

  • theme/** - All Shopify theme files
  • vite.config.js - Build configuration
  • jsconfig.json - Path aliases
  • package.json - Dependencies
  • pnpm-lock.yaml - Lock file
  • .github/workflows/[workflow-name].yml - Workflow file itself

Benefits

Reduced CI noise - No Shopify preview themes for docs-only PRs
Faster feedback - Skip unnecessary builds
Cost optimization - Fewer CI minutes used
Follows existing patterns - Matches docs-deploy.yml approach

Important Note

GitHub Actions workflows run from the base branch (main), not the PR branch. This is a security feature. Once this PR is merged, subsequent PRs will use the filtered workflows.

How to Test After Merge

  1. Create a docs-only PR (change only docs/** files)
  2. Verify pr-preview.yml does NOT run
  3. Verify docs-deploy.yml DOES run
  4. Create a theme PR (change theme/** files)
  5. Verify pr-preview.yml DOES run

Manual Override

Manual deploys via workflow_dispatch still work regardless of changed files.

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

- PR preview workflow now only runs when theme files change
- Deploy workflow only runs when theme files change (manual dispatch still unrestricted)
- Prevents unnecessary CI runs and Shopify theme creation for docs-only changes
- Follows same pattern as docs-deploy.yml path filtering

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

Preview theme deployed

Theme: PR #3 - workflow-path-filtering

Preview Open store preview
Editor Open theme editor

@jonathanmoore jonathanmoore merged commit 7a9c537 into main Apr 9, 2026
3 checks passed
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