Created
June 19, 2024 04:00
-
-
Save jlbruno/4d7958e683c68c75bf8a578b04ef19a4 to your computer and use it in GitHub Desktop.
github action for running shopify theme check while ignoring commits from shopify[bot]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .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' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment