Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/cron-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
check-links:
if: github.repository_owner == 'storybookjs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/fork-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Fork checks

# This workflow is only for forks, so they can get basic checks in without a CircleCI API key
on:
push:
Comment on lines +4 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add pull_request trigger to enable checks on fork PRs.

The workflow currently only triggers on push events, which means code reviews and PR checks won't automatically run for contributors. Add the pull_request trigger so checks execute when PRs are opened or updated.

  on:
    push:
+   pull_request:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
on:
push:
on:
push:
pull_request:
🤖 Prompt for AI Agents
In .github/workflows/fork-checks.yml around lines 4 to 5 the workflow only
triggers on push, so forked PRs won’t run checks automatically; update the
top-level events to include pull_request (e.g., add pull_request with useful
activity types like opened, reopened, synchronize) alongside push so the
workflow runs when PRs are created or updated.


env:
NODE_OPTIONS: '--max_old_space_size=4096'

jobs:
check:
name: Core Type Checking
if: github.repository_owner != 'storybookjs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Node.js and Install Dependencies
uses: ./.github/actions/setup-node-and-install
with:
install-code-deps: true

- name: check
run: yarn task --task check

prettier:
name: Core Formatting
if: github.repository_owner != 'storybookjs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Node.js and Install Dependencies
uses: ./.github/actions/setup-node-and-install
with:
install-code-deps: true

- name: prettier
run: cd code && yarn lint:prettier --check .

test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
name: Core Unit Tests, ${{ matrix.os }}
if: github.repository_owner != 'storybookjs'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Node.js and Install Dependencies
uses: ./.github/actions/setup-node-and-install
with:
install-code-deps: true

- name: compile
run: yarn task --task compile --start-from=compile

- name: Install Playwright Dependencies
run: cd code && yarn exec playwright install chromium --with-deps

- name: test
run: yarn test
2 changes: 2 additions & 0 deletions .github/workflows/generate-sandboxes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ defaults:
jobs:
generate-next:
name: Generate to next
if: github.repository_owner == 'storybookjs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -76,6 +77,7 @@ jobs:

generate-main:
name: Generate to main
if: github.repository_owner == 'storybookjs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/handle-release-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:

jobs:
branch-checks:
if: github.repository_owner == 'storybookjs'
runs-on: ubuntu-latest
steps:
- id: get-branch
Expand Down Expand Up @@ -68,7 +69,7 @@ jobs:
branch: ${{ needs.get-next-release-branch.outputs.branch }}

next-release-branch-check:
if: ${{ always() }}
if: ${{ always() && github.repository_owner == 'storybookjs' }}
needs: [branch-checks, get-next-release-branch]
runs-on: ubuntu-latest
steps:
Expand All @@ -87,7 +88,7 @@ jobs:
check: ${{ env.is-next-release-branch }}

request-create-frontpage-branch:
if: ${{ always() }}
if: ${{ always() && github.repository_owner == 'storybookjs' }}
needs:
[branch-checks, next-release-branch-check, create-next-release-branch]
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/prepare-non-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ concurrency:
jobs:
prepare-non-patch-pull-request:
name: Prepare non-patch pull request
if: github.repository_owner == 'storybookjs'
runs-on: ubuntu-latest
environment: Release
defaults:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/prepare-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ concurrency:
jobs:
prepare-patch-pull-request:
name: Prepare patch pull request
if: github.repository_owner == 'storybookjs'
runs-on: ubuntu-latest
environment: Release
defaults:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
name: Publish normal version
runs-on: ubuntu-latest
if: |
github.repository_owner == 'storybookjs' &&
github.event_name == 'push' &&
(github.ref_name == 'latest-release' || github.ref_name == 'next-release') &&
contains(github.event.head_commit.message, '[skip ci]') != true
Expand Down Expand Up @@ -221,6 +222,7 @@ jobs:
name: Publish canary version
runs-on: ubuntu-latest
if: |
github.repository_owner == 'storybookjs' &&
(
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && endsWith(github.head_ref, 'with-canary-release'))
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
stale:
runs-on: ubuntu-latest
if: github.repository_owner == 'storybookjs'
steps:
- uses: actions/stale@v9
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tests-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ on:
types: [opened, synchronize, reopened]

env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'

jobs:
build:
name: Core Unit Tests, windows-latest
if: github.repository_owner == 'storybookjs'
runs-on: windows-11-arm
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ permissions:
jobs:
triage:
name: Nissuer
if: github.repository_owner == 'storybookjs'
runs-on: ubuntu-latest
steps:
- uses: balazsorban44/[email protected]
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/trigger-circle-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ concurrency:

jobs:
get-branch:
if: github.repository_owner == 'storybookjs'
runs-on: ubuntu-latest
steps:
- id: get-branch
Expand All @@ -37,6 +38,7 @@ jobs:
branch: ${{ env.branch }}

get-parameters:
if: github.repository_owner == 'storybookjs'
runs-on: ubuntu-latest
steps:
- if: github.event_name == 'pull_request_target' && (contains(github.event.pull_request.labels.*.name, 'ci:normal'))
Expand All @@ -55,7 +57,7 @@ jobs:
trigger-circle-ci-workflow:
runs-on: ubuntu-latest
needs: [get-branch, get-parameters]
if: needs.get-parameters.outputs.workflow != ''
if: github.repository_owner == 'storybookjs' && needs.get-parameters.outputs.workflow != ''
steps:
- name: Trigger Normal tests
uses: fjogeleit/http-request-action@v1
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ Here's a highlight of notable directories and files:

### Fork the repository

If you plan to contribute to Storybook's codebase, you should fork the repository to your GitHub account. This will allow you to make changes to the codebase and submit a pull request to the main repository when you're ready to contribute your changes. Once you've forked the repository, you should [disable Github Actions for your forked repository](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository) as most of them (e.g., pushing to sandbox) will fail without proper authorization. In your forked repository, go to Settings > Actions > General > set the Actions Permissions to **Disable actions**. Additionally, adding our codebase as upstream ensures you can rebase against the latest changes in the main repository. To do this, run the following commands:
If you plan to contribute to Storybook's codebase, you should fork the repository to your GitHub account. This will allow you to make changes to the codebase and submit a pull request to the main repository when you're ready to contribute your changes.

Additionally, adding our codebase as upstream ensures you can rebase against the latest changes in the main repository. To do this, run the following commands:

```shell
git remote add upstream https://github.com/storybookjs/storybook.git
Expand Down
8 changes: 7 additions & 1 deletion code/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ bench
/.nx/cache
core/report

/.nx/workspace-data
/.nx/workspace-data

# This file contains imports with an order that must be preserved.
core/src/core-server/presets/common-manager.ts

# This file is modified by build/check, causing errors when changed in CI jobs.
lib/eslint-plugin/docs/rules/no-stories-of.md
2 changes: 0 additions & 2 deletions code/core/src/core-server/presets/common-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { global } from '@storybook/global';

import { addons } from 'storybook/manager-api';

/* eslint-disable prettier/prettier */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is questionable. To make sure prettier doesn't mess with our sensitive files in forked repos, we need to actually add them to prettierignore.

But this is a less good setup for us where we know internally that specific bits of the files should be ignored, but still want automatic formatting on the rest of the files through ESLint.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is prettierignore better for forks here?

Is it because forks run prettier directly instead of via eslint? If so, can we just add a prettierignore comment as well as the existing eslint comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. See how our command uses eslint-disable to prevent prettifying? We don't appear to be running prettier directly in the monorepo. If we don't ignore the file in prettier, the file's content changes when running prettier. So actually ignoring the file results in stronger protection (at the expense of no longer having ESLint format the rest).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(btw I meant that my code change was questionable, not the original code ;-) so thanks for questioning it!)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Even going as far as this doesn't stop prettier. Both VSCode and yarn lint:prettier change import order.

// THE ORDER OF THESE IMPORTS MATTERS! IT DEFINES THE ORDER OF PANELS AND TOOLS!
import controlsManager from '../../controls/manager';
import actionsManager from '../../actions/manager';
Expand All @@ -12,7 +11,6 @@ import backgroundsManager from '../../backgrounds/manager';
import measureManager from '../../measure/manager';
import outlineManager from '../../outline/manager';
import viewportManager from '../../viewport/manager';
/* eslint-enable prettier/prettier */

const TAG_FILTERS = 'tag-filters';
const STATIC_FILTER = 'static-filter';
Expand Down
32 changes: 7 additions & 25 deletions code/frameworks/angular/build-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,18 @@
"compodocArgs": {
"type": "array",
"description": "Compodoc options : https://compodoc.app/guides/options.html. Options `-p` with tsconfig path and `-d` with workspace root is always given.",
"default": [
"-e",
"json"
],
"default": ["-e", "json"],
"items": {
"type": "string"
}
},
"webpackStatsJson": {
"type": [
"boolean",
"string"
],
"type": ["boolean", "string"],
"description": "Write Webpack Stats JSON to disk",
"default": false
},
"statsJson": {
"type": [
"boolean",
"string"
],
"type": ["boolean", "string"],
"description": "Write stats JSON to disk",
"default": false
},
Expand Down Expand Up @@ -125,10 +116,7 @@
}
},
"sourceMap": {
"type": [
"boolean",
"object"
],
"type": ["boolean", "object"],
"description": "Configure sourcemaps. See: https://angular.io/guide/workspace-config#source-map-configuration",
"default": false
},
Expand Down Expand Up @@ -170,11 +158,7 @@
}
},
"additionalProperties": false,
"required": [
"glob",
"input",
"output"
]
"required": ["glob", "input", "output"]
},
{
"type": "string"
Expand Down Expand Up @@ -202,9 +186,7 @@
}
},
"additionalProperties": false,
"required": [
"input"
]
"required": ["input"]
},
{
"type": "string",
Expand All @@ -213,4 +195,4 @@
]
}
}
}
}
32 changes: 7 additions & 25 deletions code/frameworks/angular/start-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@
"compodocArgs": {
"type": "array",
"description": "Compodoc options : https://compodoc.app/guides/options.html. Options `-p` with tsconfig path and `-d` with workspace root is always given.",
"default": [
"-e",
"json"
],
"default": ["-e", "json"],
"items": {
"type": "string"
}
Expand Down Expand Up @@ -135,18 +132,12 @@
"description": "URL path to be appended when visiting Storybook for the first time"
},
"webpackStatsJson": {
"type": [
"boolean",
"string"
],
"type": ["boolean", "string"],
"description": "Write Webpack Stats JSON to disk",
"default": false
},
"statsJson": {
"type": [
"boolean",
"string"
],
"type": ["boolean", "string"],
"description": "Write stats JSON to disk",
"default": false
},
Expand All @@ -160,10 +151,7 @@
"pattern": "(silly|verbose|info|warn|silent)"
},
"sourceMap": {
"type": [
"boolean",
"object"
],
"type": ["boolean", "object"],
"description": "Configure sourcemaps. See: https://angular.io/guide/workspace-config#source-map-configuration",
"default": false
},
Expand Down Expand Up @@ -205,11 +193,7 @@
}
},
"additionalProperties": false,
"required": [
"glob",
"input",
"output"
]
"required": ["glob", "input", "output"]
},
{
"type": "string"
Expand Down Expand Up @@ -237,9 +221,7 @@
}
},
"additionalProperties": false,
"required": [
"input"
]
"required": ["input"]
},
{
"type": "string",
Expand All @@ -248,4 +230,4 @@
]
}
}
}
}
Loading