Never lose track of your Shopify theme changes: automated Shopify theme backups with GitHub Actions
Scheduled GitHub Actions + the Shopify CLI give you daily, diff-friendly backups of your live theme, with real commit history and no vendor lock-in.
The problem with manual theme management
Shopify lets you edit theme code and restore individual file versions, but tracking changes across time, especially with multiple editors, is painful. Version controlling your theme in Git would be the obvious answer, except Shopify doesn't ship that out of the box.
The solution: automated backups with GitHub Actions
Scheduled GitHub Actions (similar to cron jobs) combined with the Shopify CLI can automatically pull remote theme changes and push them to a GitHub repository. Every morning you have a clean diff of what changed, committed to a real branch, stored somewhere you control.
Setup
Prerequisites
- Create a private Shopify app for your store.
- Give it read permission for themes.
- Configure GitHub Secrets under
Settings / Secrets / Actions:SHOPIFY_SHOPandSHOPIFY_APP_PASSWORD. - Use Admin API credentials. Theme Kit Access app passwords may not work with the current Shopify CLI flow.
Workflow
Add this file at .github/workflows/shopify-backup.yml in a repository that contains (or will contain) your theme code:
name: Pull Shopify Theme
on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
jobs:
pull:
name: Backup
runs-on: ubuntu-latest
env:
CI: 1
SHOPIFY_SHOP: ${{ secrets.SHOPIFY_SHOP }}
SHOPIFY_PASSWORD: ${{ secrets.SHOPIFY_APP_PASSWORD }}
steps:
- name: Install
run: sudo gem install shopify-cli
- name: Checkout
uses: actions/checkout@v2
- name: Pull theme
run: |
shopify login
shopify theme pull --live
- name: Check for changes and apply
run: |
git config --global user.name 'YOUR BOT NAME'
git config --global user.email 'SOME E-MAIL'
{
git add --all && git commit -m "feat: remote from `date`" && git push && printf "\n" && echo "::notice::✅ Updated with latest from remote Shopify theme"
} || {
printf "\n" && echo "::notice::ℹ️ There are no updates in the remote Shopify theme"
}
Implementation notes
- Update the git user name and email placeholders with your bot credentials.
- The action runs daily at 03:00 UTC and only commits when there are real changes to push.
- You can also run it on demand via the
workflow_dispatchtrigger in the GitHub Actions UI. - If you want branch protection on
main, point the action at a dedicatedshopify/branch and merge manually.
This gets you change tracking, rollback, and diff review for what was previously a black-box live-edit workflow, at zero ongoing cost.