chromaui/chromatic-cli

Github Action onlyStoryFiles not respected

strewhella opened this issue · 4 comments

Bug report

I'm attempting to use the onlyStoryFiles option for the Github Action to limit snapshots and tests to only files of the form **/*.chromatic.tsx instead of the **/*.stories.tsx so I can incrementally add stories, but the setting doesn't appear to be respected. In this build I have 1 story matching the **/*.chromatic.tsx glob, but all stories except that one are picked up instead. Am I doing something wrong here, or is this a bug?

image

Hi @strewhella. That is definitely an unexpected behavior. I just tested this out using a parameter like onlyStoryFiles: '**/*utton.stories.jsx' and it worked as expected. Can you share your GitHub Action workflow?

huonw commented

Hi @andrewortwein, thanks for checking. The parts of the workflow that seem relevant are something like (sorry, it's hard to share the full details):

jobs:
  storybook:
    runs-on: ubuntu-latest
...
    steps:
      - uses: actions/checkout@v3
        with:
          # https://www.chromatic.com/docs/github-actions#support-for-codeactionscheckoutv2code-and-above
          fetch-depth: 0

      - uses: actions/setup-node@v3
        with:
          node-version: "18.13"

...

      - name: "Storybook: publish to Chromatic"
        uses: chromaui/action@v1
        env:
          NODE_OPTIONS: --max-old-space-size=16384
          DISABLE_CHROMATIC_SNAPSHOTS: ${{ env.DISABLE_CHROMATIC_SNAPSHOTS == 'true' }}
        with:
           projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
           workingDir: client/web
           exitOnceUploaded: true
           onlyStoryFiles: "**/*.chromatic.tsx"

And the one story file is something like client/web/src/app/foo/bar.chromatic.tsx.

Versions at the time of that build:

(I work with Simon.)

Hmm, I don't believe my test included the workingDir parameter, so maybe that's part of the problem. I'm away from my computer, so I'm only speculating here, but does that parameter need to be in quotes? We show it being in quotes in the docs, but I don't know if that is mandatory.

huonw commented

I don't think so. For instance, loading the following YAML in a couple of different YAML loaders gives the same value for both workingDirs, e.g. http://nodeca.github.io/js-yaml/#yaml=cXVvdGVkOgogIHdvcmtpbmdEaXI6ICJjbGllbnQvd2ViIgp1bnF1b3RlZDoKICB3b3JraW5nRGlyOiBjbGllbnQvd2ViCg==

quoted:
  workingDir: "client/web"
unquoted:
  workingDir: client/web