Skip to content

Instantly share code, notes, and snippets.

@jlbruno
Created June 19, 2024 04:00
Show Gist options
  • Select an option

  • Save jlbruno/4d7958e683c68c75bf8a578b04ef19a4 to your computer and use it in GitHub Desktop.

Select an option

Save jlbruno/4d7958e683c68c75bf8a578b04ef19a4 to your computer and use it in GitHub Desktop.

Revisions

  1. jlbruno created this gist Jun 19, 2024.
    42 changes: 42 additions & 0 deletions code-check.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    # .github/workflows/code-check.yml
    name: Code Check
    on: [push]
    jobs:
    code-check:
    name: Code Checks
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
    uses: actions/checkout@v4

    - name: Get commit author
    id: get_author
    run: |
    echo "author=$(git log -1 --pretty=format:'%an')" >> $GITHUB_ENV
    - name: Check if author is specific user
    if: env.author != 'shopify[bot]'
    run: echo "Proceeding with the workflow because the author is not 'shopify[bot]'"

    - name: Cache node_modules
    id: cache-node-modules
    uses: actions/cache@v4
    with:
    path: ~/.npm
    key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
    restore-keys: |
    ${{ runner.os }}-node_modules-
    - name: Install Shopify CLI
    if: steps.cache-node-modules.outputs.cache-hit != 'true'
    run: |
    npm install --no-package-lock --no-save @shopify/cli
    - name: Run Theme Check on changed files
    if: env.author != 'shopify[bot]'
    uses: shopify/theme-check-action@v2
    with:
    theme_root: '.' # optional, could be './dist'
    token: ${{ github.token }}
    base: develop
    # flags: '--verbose'