Skip to content

[Bug]: Issue with Slashes (/) in File Names When Using the --shard Option #525

Open
@hiraly

Description

@hiraly

To Reproduce

When running the Storybook Test Runner with the --shard option in GitHub Actions, issues occur due to the inclusion of slashes (e.g., 1/10) in shard names. This is particularly problematic when renaming files or uploading artifacts.

Steps to reproduce:

  1. Execute the following GitHub Actions job:
    jobs:
      storybook-test:
        strategy:
          matrix:
            shard: [1/10, 2/10]
        steps:
          - name: Run Storybook Tests
            run: npx storybook test --shard=${{ matrix.shard }} --coverage
          - name: Upload Coverage File
            run: mv coverage/storybook/coverage.json coverage/storybook/coverage-${{ matrix.shard }}.json
  2. The job fails with an error because file names containing slashes (e.g., coverage-1/10.json) are invalid:
    mv: cannot move 'coverage/storybook/coverage.json' to 'coverage/storybook/coverage-1/10.json': No such file or directory
    

System

Its on Github Action CI


Additional Context

In GitHub Actions, file and artifact names containing slashes (/) are invalid and result in errors. Currently, we use the following workaround:

  1. Escape shard names (e.g., 1/10) using a custom script:
    mv coverage/storybook/coverage.json coverage/storybook/coverage-1_10.json
  2. Use the escaped shard names (e.g., 1_10) as artifact names.

To improve usability, we propose the following enhancements:

  • Add internal logic to escape slashes in shard names.
  • Alternatively, provide an option to customize the shard name format.

These changes would eliminate the need for manual scripting and make the Test Runner more CI-friendly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions