Giter Site home page Giter Site logo

upesylabs / shopify-theme-preview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brand-boosting-gmbh/shopify-theme-preview

0.0 0.0 1.0 35 KB

This GitHub action creates a preview of a pull request for a Shopify store. Adding a simple comment in the corresponding pull request will trigger this action and creates links for a preview of the store and the shopify editor.

License: MIT License

shopify-theme-preview's Introduction

Create Shopify Theme Preview

This GitHub action creates a preview of a pull request for a Shopify store. Adding a simple comment in the corresponding pull request will trigger this action and creates links for a preview of the store and the shopify editor. This makes it easier to see the changes made in a pull request before they are merged.

Inputs

Name Description Example Required
shopify_flag_store Your Store URL your-store.myshopify.com
shopify_cli_theme_token Password generated from Theme Access App shptka_7e95eace43t00be7f9f8612325212805
build_step Command used as build step npm i
dir Directory to preview dist
timezone Timezone to use (default is UTC) Europe/Berlin

Example usage

Create a preview link and add it to the comment

This Action can be triggered by adding the !preview keyword to a pull request comment. It will then replace the entire comment with a table that includes a preview and editor link. This keyword can be changed to filter for a different string in the pull request comments. Remember to generate a shopify_cli_theme_token for the repository and pass it to the input of this action, along with the shopify_flag_store, which is your store URL.

For more information on how to set up the shopify_cli_theme_token follow this Theme Access App Guide

Optional inputs

Optionally you can add the inputs build_step and dir to the composite action. These inputs are used if there are specific requirements to preview the theme like a custom build step or changing the route to a different path before the preview is deployed.

preview.yml

run-name: Create Theme Preview by @${{ github.actor }}

permissions: 
  pull-requests: write

on:
  issue_comment:      
    types: [created]    
jobs:                   
  deploy:
    name: Preview
    runs-on: ubuntu-latest
    if: contains(github.event.comment.body, '!preview')
    steps:
      - uses: Brand-Boosting-GmbH/[email protected]
        with:
          shopify_flag_store: 'your-store.myshopify.com'
          shopify_cli_theme_token: 'shopify_cli_theme_token'
          build_step: 'npm i && npm run build'              // optional
          dir: 'dist'                                       // optional
          timezone: 'Europe/Berlin'                         // optional

To trigger the action write a comment with the defined keyword:

image

After the action finished loading, the comment will be replaced with a table that contains the links for the Shopify store preview:

image

Composite action steps

The action has the following steps:

  1. Get the current date and time
  2. Create a comment on the pull request for the loading state with a table containing the name of the store, the status of the preview creation, and the date and time of the action
  3. Check out the current pull request
  4. Set up Node.js and Ruby
  5. Install the Shopify CLI
  6. Optional build step via build-step-input
  7. Use the Shopify CLI to create the preview and save the returned preview link in an output object (optional path via dir-input)
  8. Update the table to display the preview links
  9. If any of the previous steps fail, create a comment on the pull request with an error message

wort-bild-primary@2x
Brand Boosting GmbH | David Süßlin

shopify-theme-preview's People

Contributors

davidpotato avatar murmeltiers avatar mc-0bit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.