Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .github/workflows/shopify-theme-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,27 @@ jobs:
- name: Install Shopify CLI
run: npm install -g @shopify/cli@latest

- name: Push unpublished theme
- name: Push theme
working-directory: ${{ inputs.working-directory }}
run: |
shopify theme push \
--unpublished \
--json \
--theme "$PR_THEME_NAME" \
> push.json
# Check if a theme with this name already exists
EXISTING_ID=$(shopify theme list --json \
| jq -r --arg name "$PR_THEME_NAME" '.[] | select(.name == $name) | .id // empty')

if [ -n "$EXISTING_ID" ]; then
echo "Updating existing preview theme (ID: $EXISTING_ID)"
shopify theme push \
--json \
--theme "$EXISTING_ID" \
> push.json
else
echo "Creating new preview theme"
shopify theme push \
--unpublished \
--json \
--theme "$PR_THEME_NAME" \
> push.json
fi

- name: Extract preview URL
id: preview
Expand Down