Giter Club home page Giter Club logo

theme-check-action's Introduction

shopify/theme-check-action

About this repo | Usage | Configuration

About this repo

Theme Check on Shopify Theme Pull Requests using GitHub Actions.

demo

Usage

Add shopify/theme-check-action to the workflow of your Shopify theme.

# .github/workflows/theme-check.yml
name: Theme Check
on: [push]
jobs:
  theme-check:
    name: Theme Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Theme Check
        uses: shopify/theme-check-action@v1
        with:
          theme_root: '.' # optional, could be './dist'
          token: ${{ github.token }}
          base: main

Configuration

The shopify/theme-check-action accepts the following arguments:

  • theme_root - (optional, default: '.') Path from repo root to the root of the theme (e.g. './dist').
  • flags - (optional) theme-check command line flags. (e.g. '--fail-level suggestion')
  • version - (optional, default: latest) specific theme-check version to use.
  • token - (optional) result of ${{ github.token }} to enable GitHub check annotations.
  • base - (optional) When token is set, only the files that contain a diff with this ref (branch, tag or commit) will have GitHub check annotations.

theme-check-action's People

Contributors

charlespwd avatar cursedcoder avatar karreiro avatar poitrin avatar vfonic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

theme-check-action's Issues

Feature Request: Only lint modified files

Currently, the action runs on all files, it would make more sense to only lint modified liquid files or at least have an optional argument to enable it, something along the lines of Github's Super-Linter

I'm not sure if that's possible considering there are checks like UnusedSnippet that would need to parse the entire codebase.

The "path" argument must be of type string. Received null

I'm getting this error when I try to run this action:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
    at new NodeError (internal/errors.js:3[22](https://github.com/<redacted-account>/<redacted-repo>/runs/6879185751?check_suite_focus=true#step:4:23):7)
    at validateString (internal/validators.js:124:11)
    at Object.join (path.js:1148:7)
    at /index.js:72:20
    at Array.map (<anonymous>)
    at /index.js:70:10
    at async /index.js:67:20

Here's my config:

  theme-check:
    name: Theme Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Theme Check
        uses: shopify/theme-check-action@v1
        with:
          theme_root: "."
          token: ${{ github.token }}
          base: v2

Error on MissingRequiredTemplateFiles failures

  TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
    at validateString (internal/validators.js:124:11)
    at Object.join (path.js:1148:7)
    at /index.js:72:20
    at Array.map (<anonymous>)
    at /index.js:70:10
    at async /index.js:67:20

When the MissingRequiredTemplateFiles rules fail, the path is null and causes this to throw.

Feature Request: Add annotations

Could annotations be added to the status checks? It would be nice to see the lint errors directly on the files.

Here's an example with stylelint
image

Error: Resource not accessible by integration

I'm running theme-check-action for the first time on a repo that belongs to a brand new GitHub organization.

This is the GH action yml:

name: Theme Check
on: [push]
jobs:
  theme-check:
    name: Theme Check
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2

      - name: Theme Check
        uses: shopify/theme-check-action@v1
        with:
          # flags: '--fail-level style'
          token: ${{ github.token }}
          base: master

This is the error that I get:

Successfully installed ast-2.4.2
Successfully installed parser-3.1.2.0
Successfully installed liquid-5.3.0
Successfully installed theme-check-1.10.2
4 gems installed
$ theme-check --version
1.10.2
$ theme-check --fail-level style -o json .
Checking . ...
$ git fetch origin master
From https://github.com/<redacted>
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
$ git diff --name-only --diff-filter=ACMRTUB origin/master
Creating GitHub check...
HttpError: Resource not accessible by integration
    at /var/task/node_modules/@octokit/request/dist-node/index.js:86:21
    at processTicksAndRejections (internal/process/task_queues.js:[9](https://github.com/<redacted>/runs/6652177544?check_suite_focus=true#step:4:10)5:5)
    at async Job.doExecute (/var/task/node_modules/bottleneck/light.js:405:[18](https://github.com/<redacted>/runs/6652177544?check_suite_focus=true#step:4:19))
Error: Resource not accessible by integration

Any ideas what could've gone wrong?

Action fails with: Error: Invalid request. No more than 50 items are allowed; 404 were supplied.

tl;dr This PR fixes this issue #7

I'm trying to setup theme-check gh action for the first time.

Here's the .github/workflows/theme-check.yml that I added to my repo:

name: Theme Check
on: [push]
jobs:
  theme-check:
    name: Theme Check
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - name: Theme Check
        uses: shopify/theme-check-action@v1
        with:
          theme_root: '.'
          token: ${{ github.token }}

Here's the error:

Run shopify/theme-check-action@v1
  with:
    theme_root: .
    token: ***
/usr/bin/docker run --name xxxxxxx --label xxxxxxx --workdir /github/workspace --rm -e INPUT_THEME_ROOT -e INPUT_TOKEN -e INPUT_FLAGS -e INPUT_VERSION -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/xxxxx/xxxxx":"/github/workspace" xxxxx:xxxxxxxxxx
Successfully installed ast-2.4.2
Successfully installed parser-3.1.1.0
Successfully installed liquid-5.1.0
Successfully installed theme-check-1.10.1
4 gems installed
theme-check --version
1.10.1
theme-check -o json . > /tmp/results.json
Checking . ...
NODE_PATH=/var/task/node_modules node /index.js
[@octokit/rest] `const Octokit = require("@octokit/rest")` is deprecated. Use `const { Octokit } = require("@octokit/rest")` instead
[@octokit/rest] `const Octokit = require("@octokit/rest")` is deprecated. Use `const { Octokit } = require("@octokit/rest")` instead
Creating GitHub check...
Converting results.json into annotations...
Updating GitHub check...
HttpError: Invalid request.
Error: Invalid request.

No more than 50 items are allowed; 404 were supplied.

No more than 50 items are allowed; 404 were supplied.
    at /var/task/node_modules/@octokit/request/dist-node/index.js:86:21
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /index.js:63:5

Result Not Showing on PR

The result of theme check is not showing, the theme check fails and the job ended.

image

We are expecting something like this!
image

Is there any help or guide that we can follow? possibly adding an action to read the result?

Error running on Pull Requests

Copied pretty much all of the config from the docs except I changed the push event to pull_request

Workflow file

name: Theme Check
on: [pull_request]
jobs:
  theme-check:
    name: Theme Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Theme Check
        uses: shopify/theme-check-action@v1
        with:
          theme_root: "." # optional, could be './dist'
          token: ${{ github.token }}
          base: master

Fails at "Theme Check" step.

2022-03-29T00:21:03.6755908Z $ theme-check --version
2022-03-29T00:21:04.2501643Z 1.10.2
2022-03-29T00:21:04.2529283Z $ theme-check -o json .
2022-03-29T00:21:04.8263471Z Checking . ...
2022-03-29T00:21:19.3398599Z $ git fetch origin master
2022-03-29T00:21:19.5627379Z From https://github.com/repeaterstore/repeaterstore-shopify
2022-03-29T00:21:19.5627818Z  * branch            master     -> FETCH_HEAD
2022-03-29T00:21:19.5668167Z $ git diff --name-only --diff-filter=ACMRTUB master
2022-03-29T00:21:19.5682071Z fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
2022-03-29T00:21:19.5682546Z Use '--' to separate paths from revisions, like this:
2022-03-29T00:21:19.5682910Z 'git <command> [<revision>...] -- [<file>...]'
2022-03-29T00:21:21.8956827Z Creating GitHub check...
2022-03-29T00:21:21.9060445Z TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
2022-03-29T00:21:21.9060827Z     at new NodeError (internal/errors.js:322:7)
2022-03-29T00:21:21.9061504Z     at validateString (internal/validators.js:124:11)
2022-03-29T00:21:21.9061813Z     at Object.join (path.js:1148:7)
2022-03-29T00:21:21.9063750Z     at /index.js:72:20
2022-03-29T00:21:21.9064106Z     at Array.map (<anonymous>)
2022-03-29T00:21:21.9064340Z     at /index.js:70:10
2022-03-29T00:21:21.9064562Z     at async /index.js:67:20
2022-03-29T00:21:21.9086505Z ##[error]The "path" argument must be of type string. Received null

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.