chromaui/chromatic-cli

GitHub Action not working

landsman opened this issue · 2 comments

Bug report

After I migrated to Storybook v7 there is an issue with Chromatic GitHub Action

Step looks like this:

      - name: 'Publish to Chromatic'
        uses: chromaui/action@v1
        with:
          projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

I also tried chromaui/action-next@v1 but result is the same.

Here is the log:

Chromatic CLI v6.17.4
https://www.chromatic.com/docs/cli

✖ Build script not found
The CLI didn't find a script called "build-storybook" in your package.json.
Make sure you set the --build-script-name option to the value of the script name that builds your Storybook.
→ View the full stacktrace below

If you need help, please chat with us at https://www.chromatic.com/docs/cli for the fastest response.
You can also email the team at support@chromatic.com if chat is not an option.

Please provide us with the above CLI output and the following info:
{
  "timestamp": "2023-05-10T19:09:31.457Z",
  "sessionId": "a5253f77-d06f-4869-bda7-35208693daf7",
  "nodePlatform": "linux",
  "nodeVersion": "16.16.0",
  "packageName": "chromatic",
  "packageVersion": "6.17.4",
  "flags": {
    "allowConsoleErrors": false,
    "exitOnceUploaded": false,
    "exitZeroOnChanges": true,
    "fromCI": true,
    "interactive": false,
    "projectToken": "***",
    "zip": false
  },
  "exitCode": 0,
  "exitCodeKey": "OK",
  "errorType": "Error",
  "errorMessage": "✖ Build script not found"
}

Error: ✖ Build script not found
The CLI didn't find a script called "build-storybook" in your package.json.
Make sure you set the --build-script-name option to the value of the script name that builds your Storybook.
    at t.default (/home/runner/work/_actions/chromaui/action/v1/action/main.js:49:31876)
    at /home/runner/work/_actions/chromaui/action/v1/action/main.js:49:61378
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/chromaui/action/v1/action/main.js:49:60432
    at new Promise (<anonymous>)
    at n (/home/runner/work/_actions/chromaui/action/v1/action/main.js:49:60177)
    at M (/home/runner/work/_actions/chromaui/action/v1/action/main.js:49:61268)
    at /home/runner/work/_actions/chromaui/action/v1/action/main.js:49:61101
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/chromaui/action/v1/action/main.js:49:60432
Error: non-zero exit code

my bad, I was missing: buildScriptName

To be fair, the error messages and default values are not matching everywhere.

In some places it's mentioned that the default is build-storybook and in other places build:storybook. 🤷