Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uicrooks/shopify-settings-control
Automatic Git version control for Shopify settings_data.json via CI/CD
https://github.com/uicrooks/shopify-settings-control
Last synced: 12 days ago
JSON representation
Automatic Git version control for Shopify settings_data.json via CI/CD
- Host: GitHub
- URL: https://github.com/uicrooks/shopify-settings-control
- Owner: uicrooks
- License: mit
- Archived: true
- Created: 2021-02-10T16:17:40.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-16T12:28:26.000Z (about 3 years ago)
- Last Synced: 2024-08-01T16:53:58.400Z (3 months ago)
- Homepage:
- Size: 46.9 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Shopify Settings Control
Automatic Git version control for Shopify `settings_data.json` via CI/CD. Create a dedicated repo to backup `settings_data.json` for a Shopify store.
> Designed to work with [Shopify Theme Lab](https://github.com/uicrooks/shopify-theme-lab).## How it works
A GitHub action runs automatically once during the specified interval. It downloads the `settings_data.json` file from the provided Shopify store. If the remote file has changed, it's committed and then pushed to this repo, if not, nothing happens. This project has a similar directory structure to Shopify Theme Lab, you will find the settings file in `shopify/config/settings_data.json` once it's added to this repo.## Getting started
### GitHub actions
> First, make sure the theme is already initialized on the Shopify store in question
1. “Use this template” to create a new repository on GitHub
2. Add the following four secrets to your Shopify Theme Lab repo in `settings` → `secrets`:
```sh
SHOPIFY_API_PASSWORD # your-api-password
SHOPIFY_STORE_URL # your-store.myshopify.com
SHOPIFY_ENV # dev or live
SHOPIFY_THEME_ID # theme-id (without quotation marks) - find the id either in shopify.[env].config.yml or with shopify:themes task in your Shopify Theme Lab project
```
3. Test the action by going to `actions` → `Shopify Settings Control` and click on `Run workflow`## Published theme
If you want to back up the settings for the published/main theme, pass the `--main` flag (shorthand `-m`) instead of the `--id` / `-i` option when initializing the config:```yml
npx themelab shopify:init -p ${{ secrets.SHOPIFY_API_PASSWORD }} -s ${{ secrets.SHOPIFY_STORE_URL }} -e ${{ secrets.SHOPIFY_ENV }} -m
```## Adjusting schedule
By default, the action is set to run once every hour. You can adjust the `cron` schedule inside [shopify-settings-control.yml](.github/workflows/shopify-settings-control.yml) to change the interval.```yml
on:
schedule:
- cron: "*/60 * * * *"
``````
┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of the month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of the week (0 - 6)
│ │ │ │ │
│ │ │ │ │
│ │ │ │ │
* * * * *
```An asterisk `*` means that the field is considered “any time” - so `* * * * *` means every minute of every day. Note that, at least on GitHub, times are based in UTC so you may have to do some timezone conversion!
To visualize chron expressions you can use [crontab.guru](https://crontab.guru).