├── README.md ├── LICENSE ├── action.yml └── package.json /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Action for Chromatic 2 | 3 | Builds and publishes your Storybook to Chromatic and runs visual regression tests. 4 | 5 | 📋 [Source code](https://github.com/chromaui/chromatic-cli) ∙ 📚 [Documentation](https://www.chromatic.com/docs/github-actions) ∙ 💬 [Support](https://www.chromatic.com/docs/support) 6 | 7 | > ⚠️ This repository is just a deployment target for the GitHub Action. Do not fork or create issues/PRs here. 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Chroma Software Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: Publish to Chromatic 2 | author: Chroma Software, Inc. 3 | description: 'Publish your Storybook to Chromatic and run visual regression tests' 4 | branding: 5 | icon: 'aperture' 6 | color: 'orange' 7 | 8 | inputs: 9 | allowConsoleErrors: 10 | description: 'Do not exit when runtime errors occur in storybook' 11 | required: false 12 | appCode: 13 | description: 'Deprecated, please use projectToken instead' 14 | required: false 15 | autoAcceptChanges: 16 | description: 'Automatically accept all changes in chromatic: boolean or branchname' 17 | required: false 18 | branchName: 19 | description: 'Override the branch name' 20 | required: false 21 | buildScriptName: 22 | description: 'The npm script that builds your Storybook [build-storybook]' 23 | required: false 24 | debug: 25 | description: 'Output verbose debugging information' 26 | required: false 27 | diagnostics: 28 | description: 'Write process context information to chromatic-diagnostics.json' 29 | required: false 30 | dryRun: 31 | description: 'Run without actually publishing to Chromatic' 32 | required: false 33 | exitOnceUploaded: 34 | description: 'Exit with 0 once the built version has been sent to chromatic: boolean or branchname' 35 | required: false 36 | exitZeroOnChanges: 37 | description: 'Positive exit of action even when there are changes: boolean or branchname' 38 | required: false 39 | externals: 40 | description: 'Disable TurboSnap when any of these files have changed since the baseline build' 41 | required: false 42 | forceRebuild: 43 | description: 'Do not skip build when a rebuild is detected' 44 | required: false 45 | ignoreLastBuildOnBranch: 46 | description: 'Do not use the last build on this branch as a baseline if it is no longer in history (i.e. branch was rebased)' 47 | required: false 48 | only: 49 | description: 'Deprecated, replaced by onlyStoryNames' 50 | required: false 51 | onlyChanged: 52 | description: 'Enables TurboSnap: Only run stories affected by files changed since the baseline build' 53 | required: false 54 | onlyStoryNames: 55 | description: 'Only run a single story or a subset of stories by their name' 56 | required: false 57 | onlyStoryFiles: 58 | description: 'Only run a single story or a subset of stories by their filename(s)' 59 | required: false 60 | preserveMissing: 61 | description: 'Deprecated, use onlyChanged, onlyStoryNames or onlyStoryFiles instead' 62 | required: false 63 | projectToken: 64 | description: 'Your chromatic project token' 65 | required: true 66 | repositorySlug: 67 | description: 'Override the repository slug (e.g. ownerName/repositoryName)' 68 | required: false 69 | skip: 70 | description: 'Skip Chromatic tests, but mark the commit as passing' 71 | required: false 72 | storybookBaseDir: 73 | description: 'Relative path from repository root to Storybook project root' 74 | required: false 75 | storybookBuildDir: 76 | description: 'Provide a directory with your built storybook; use if you have already built your storybook' 77 | required: false 78 | storybookConfigDir: 79 | description: 'Relative path from where you run Chromatic to your Storybook config directory' 80 | required: false 81 | token: 82 | description: 'Your github token' 83 | required: false 84 | traceChanged: 85 | description: 'Print dependency trace for changed files to affected story files; set to "expanded" to list individual modules' 86 | required: false 87 | untraced: 88 | description: 'Disregard these files and their dependencies when tracing dependent stories for TurboSnap' 89 | required: false 90 | workingDir: 91 | description: 'Working directory for the package.json file' 92 | required: false 93 | zip: 94 | description: 'Publish your Storybook to Chromatic as a single zip file instead of individual content files' 95 | required: false 96 | junitReport: 97 | description: 'Write build results to a JUnit XML file.' 98 | required: false 99 | 100 | outputs: 101 | code: 102 | description: 'The exit code for the current run of the Chromatic CLI' 103 | url: 104 | description: 'An alias for the build URL (e.g. https://www.chromatic.com/build?appId=&number=)' 105 | buildUrl: 106 | description: 'The build URL (e.g. https://www.chromatic.com/build?appId=&number=)' 107 | storybookUrl: 108 | description: 'The Storybook preview URL for your current branch / Pull Request (e.g. https://-.chromatic.com/)' 109 | specCount: 110 | description: 'The number of stories in the published Storybook' 111 | componentCount: 112 | description: 'The number of components in the published Storybook' 113 | testCount: 114 | description: 'The number of tests on the build' 115 | changeCount: 116 | description: 'The number of tests with visual changes, including any inherited changes (e.g. due to TurboSnap)' 117 | errorCount: 118 | description: 'The number of tests with error(s), including any inherited errors (e.g. due to TurboSnap)' 119 | interactionTestFailuresCount: 120 | description: 'The number of stories with interaction test failures' 121 | actualCaptureCount: 122 | description: 'The number of captured snapshots' 123 | inheritedCaptureCount: 124 | description: 'The number of inherited (not captured) snapshots (e.g. due to TurboSnap)' 125 | 126 | runs: 127 | main: action/register.js 128 | using: node16 129 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chromatic", 3 | "version": "6.20.0", 4 | "description": "Automate visual testing across browsers. Gather UI feedback. Versioned documentation.", 5 | "keywords": [ 6 | "storybook-addon", 7 | "storybook", 8 | "addon", 9 | "test", 10 | "popular" 11 | ], 12 | "homepage": "https://www.chromatic.com", 13 | "bugs": { 14 | "url": "https://github.com/chromaui/chromatic-cli", 15 | "email": "support@chromatic.com" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/chromaui/chromatic-cli.git" 20 | }, 21 | "license": "MIT", 22 | "exports": { 23 | ".": { 24 | "types": "./dist/node.d.ts", 25 | "require": "./isChromatic.js", 26 | "import": "./isChromatic.mjs" 27 | }, 28 | "./node": { 29 | "types": "./dist/node.d.ts", 30 | "require": "./dist/node.js", 31 | "node": "./dist/node.js" 32 | }, 33 | "./isChromatic": { 34 | "types": "./isChromatic.d.ts", 35 | "require": "./isChromatic.js", 36 | "import": "./isChromatic.mjs" 37 | } 38 | }, 39 | "main": "isChromatic.js", 40 | "module": "isChromatic.mjs", 41 | "typesVersions": { 42 | "*": { 43 | "*": [ 44 | "./isChromatic.d.ts" 45 | ], 46 | "isChromatic": [ 47 | "./isChromatic.d.ts" 48 | ], 49 | "node": [ 50 | "dist/node.d.ts" 51 | ] 52 | } 53 | }, 54 | "bin": { 55 | "chroma": "dist/bin.js", 56 | "chromatic": "dist/bin.js", 57 | "chromatic-cli": "dist/bin.js" 58 | }, 59 | "files": [ 60 | "dist/*.js", 61 | "dist/node.d.ts", 62 | "isChromatic.js", 63 | "isChromatic.mjs", 64 | "isChromatic.d.ts" 65 | ], 66 | "scripts": { 67 | "build": "tsup", 68 | "build-storybook": "build-storybook -s static", 69 | "build-test-storybook": "cross-env SMOKE_TEST=true build-storybook -o test-storybook", 70 | "build-subdir": "cd subdir ; yarn build ; cd ..", 71 | "chromatic": "./dist/bin.js", 72 | "chromatic-prebuilt": "./dist/bin.js --storybook-build-dir=\"storybook-static\"", 73 | "chromatic-staging": "CHROMATIC_INDEX_URL=https://www.staging-chromatic.com ./dist/bin.js", 74 | "chromatic-verbose": "cross-env LOG_LEVEL=verbose ./dist/bin.js", 75 | "lint": "yarn lint:js .storybook bin-src node-src test-stories ./isChromatic.js ./isChromatic.mjs", 76 | "lint:js": "cross-env NODE_ENV=production eslint --fix --cache --cache-location=.cache/eslint --ext .js,.json,.mjs,.ts,.cjs --report-unused-disable-directives", 77 | "lint:package": "sort-package-json", 78 | "release": "node scripts/release.js", 79 | "trace": "node -r esm bin-src/trace.js", 80 | "trim-stats": "node -r esm bin-src/trim-stats-file.js", 81 | "storybook": "start-storybook -p 9009 -s static", 82 | "test": "jest", 83 | "prepare": "husky install && npm run build", 84 | "dev": "tsup --watch", 85 | "lint-staged": "lint-staged" 86 | }, 87 | "lint-staged": { 88 | "*.ts": [ 89 | "yarn lint:js --fix" 90 | ], 91 | "*.js": [ 92 | "yarn lint:js --fix" 93 | ], 94 | "*.json": [ 95 | "yarn lint:js --fix" 96 | ], 97 | "package.json": [ 98 | "yarn lint:package" 99 | ] 100 | }, 101 | "resolutions": { 102 | "any-observable": "^0.5.1" 103 | }, 104 | "dependencies": {}, 105 | "devDependencies": { 106 | "@actions/core": "^1.10.0", 107 | "@actions/github": "^5.0.0", 108 | "@babel/cli": "^7.14.8", 109 | "@babel/core": "^7.15.0", 110 | "@babel/node": "^7.15.4", 111 | "@babel/plugin-transform-runtime": "^7.15.0", 112 | "@babel/preset-env": "^7.15.0", 113 | "@babel/preset-typescript": "^7.15.0", 114 | "@babel/runtime": "^7.15.3", 115 | "@discoveryjs/json-ext": "^0.5.7", 116 | "@storybook/addon-essentials": "^6.5.6", 117 | "@storybook/builder-webpack5": "^6.5.6", 118 | "@storybook/csf-tools": "^7.0.12", 119 | "@storybook/eslint-config-storybook": "^3.1.2", 120 | "@storybook/linter-config": "^3.1.2", 121 | "@storybook/manager-webpack5": "^6.5.6", 122 | "@storybook/react": "^6.5.6", 123 | "@types/archiver": "^5.3.1", 124 | "@types/async-retry": "^1.4.3", 125 | "@types/cross-spawn": "^6.0.2", 126 | "@types/fs-extra": "^9.0.13", 127 | "@types/jest": "^27.5.0", 128 | "@types/jsonfile": "^6.0.1", 129 | "@types/listr": "^0.14.4", 130 | "@types/node": "^14.14.25", 131 | "@types/picomatch": "^2.3.0", 132 | "@types/progress-stream": "^2.0.2", 133 | "@types/semver": "^7.3.9", 134 | "@typescript-eslint/eslint-plugin": "^5.59.8", 135 | "@typescript-eslint/parser": "^5.59.8", 136 | "ansi-html": "0.0.8", 137 | "any-observable": "^0.5.1", 138 | "archiver": "^5.3.0", 139 | "async-retry": "^1.3.3", 140 | "babel-preset-minify": "^0.5.1", 141 | "chalk": "^4.1.2", 142 | "cpy": "^8.1.2", 143 | "cross-env": "^7.0.3", 144 | "cross-spawn": "^7.0.2", 145 | "debug": "^4.3.2", 146 | "dotenv": "^8.2.0", 147 | "env-ci": "^5.0.2", 148 | "esbuild-jest": "^0.5.0", 149 | "eslint": "^7.32.0", 150 | "eslint-plugin-jest": "^27.2.1", 151 | "esm": "^3.2.25", 152 | "execa": "^5.0.0", 153 | "fake-tag": "^2.0.0", 154 | "fs-extra": "^10.0.0", 155 | "https-proxy-agent": "^5.0.0", 156 | "husky": "^7.0.0", 157 | "jest": "^27.0.6", 158 | "jsonfile": "^6.0.1", 159 | "junit-report-builder": "2.1.0", 160 | "lint-staged": "^11.1.2", 161 | "listr": "0.14.3", 162 | "meow": "^9.0.0", 163 | "mock-fs": "^5.1.2", 164 | "no-proxy": "^1.0.3", 165 | "node-ask": "^1.0.1", 166 | "node-fetch": "3.2.10", 167 | "node-loggly-bulk": "^4.0.1", 168 | "npm-run-all": "^4.0.2", 169 | "observable": "^2.1.4", 170 | "os-browserify": "^0.3.0", 171 | "p-limit": "3.1.0", 172 | "picomatch": "2.2.2", 173 | "pkg-up": "^3.1.0", 174 | "pluralize": "^8.0.0", 175 | "prettier": "^2.3.2", 176 | "progress-stream": "^2.0.0", 177 | "prop-types": "^15.7.2", 178 | "react": "^17.0.2", 179 | "react-dom": "^17.0.2", 180 | "read-pkg-up": "^7.0.1", 181 | "semver": "^7.3.5", 182 | "slash": "^3.0.0", 183 | "snyk-nodejs-lockfile-parser": "^1.49.0", 184 | "sort-package-json": "1.50.0", 185 | "string-argv": "^0.3.1", 186 | "strip-ansi": "6.0.0", 187 | "tmp-promise": "3.0.2", 188 | "tree-kill": "^1.2.2", 189 | "ts-dedent": "^1.0.0", 190 | "ts-loader": "^9.2.5", 191 | "ts-node": "^10.9.1", 192 | "tsup": "^6.7.0", 193 | "typescript": "^4.3.5", 194 | "util-deprecate": "^1.0.2", 195 | "uuid": "^8.3.2", 196 | "why-is-node-running": "^2.1.2", 197 | "yarn-or-npm": "^3.0.1", 198 | "zen-observable": "^0.8.15" 199 | }, 200 | "publishConfig": { 201 | "access": "public", 202 | "registry": "https://registry.npmjs.org/" 203 | }, 204 | "docs": "https://www.chromatic.com/docs/cli", 205 | "storybook": { 206 | "icon": "https://user-images.githubusercontent.com/263385/101995175-2e087800-3c96-11eb-9a33-9860a1c3ce62.gif", 207 | "displayName": "Chromatic" 208 | } 209 | } 210 | --------------------------------------------------------------------------------