mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
[CL-394] Only run Chromatic action on relevant PRs (#14065)
This commit is contained in:
19
.github/workflows/chromatic.yml
vendored
19
.github/workflows/chromatic.yml
vendored
@@ -28,9 +28,22 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Get changed files
|
||||||
|
id: get-changed-files-for-chromatic
|
||||||
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
storyFiles:
|
||||||
|
- "apps/!(cli)/**"
|
||||||
|
- "bitwarden_license/bit-web/src/app/**"
|
||||||
|
- "libs/!(eslint)/**"
|
||||||
|
- "package.json"
|
||||||
|
- ".storybook/**"
|
||||||
|
|
||||||
- name: Get Node version
|
- name: Get Node version
|
||||||
id: retrieve-node-version
|
id: retrieve-node-version
|
||||||
|
if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true'
|
||||||
run: |
|
run: |
|
||||||
NODE_NVMRC=$(cat .nvmrc)
|
NODE_NVMRC=$(cat .nvmrc)
|
||||||
NODE_VERSION=${NODE_NVMRC/v/''}
|
NODE_VERSION=${NODE_NVMRC/v/''}
|
||||||
@@ -40,6 +53,7 @@ jobs:
|
|||||||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version: ${{ steps.retrieve-node-version.outputs.node_version }}
|
node-version: ${{ steps.retrieve-node-version.outputs.node_version }}
|
||||||
|
if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true'
|
||||||
|
|
||||||
- name: Cache NPM
|
- name: Cache NPM
|
||||||
id: npm-cache
|
id: npm-cache
|
||||||
@@ -47,12 +61,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: "~/.npm"
|
path: "~/.npm"
|
||||||
key: ${{ runner.os }}-npm-chromatic-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.os }}-npm-chromatic-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true'
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
|
if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true'
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
# Manually build the Storybook to resolve a bug related to TurboSnap
|
# Manually build the Storybook to resolve a bug related to TurboSnap
|
||||||
- name: Build Storybook
|
- name: Build Storybook
|
||||||
|
if: steps.get-changed-files-for-chromatic.outputs.storyFiles == 'true'
|
||||||
run: npm run build-storybook:ci
|
run: npm run build-storybook:ci
|
||||||
|
|
||||||
- name: Publish to Chromatic
|
- name: Publish to Chromatic
|
||||||
@@ -64,3 +81,5 @@ jobs:
|
|||||||
exitOnceUploaded: true
|
exitOnceUploaded: true
|
||||||
onlyChanged: true
|
onlyChanged: true
|
||||||
externals: "[\"libs/components/**/*.scss\", \"libs/components/**/*.css\", \"libs/components/tailwind.config*.js\"]"
|
externals: "[\"libs/components/**/*.scss\", \"libs/components/**/*.css\", \"libs/components/tailwind.config*.js\"]"
|
||||||
|
# Rather than use an `if` check on the whole publish step, we need to tell Chromatic to skip so that any Chromatic-spawned actions are properly skipped
|
||||||
|
skip: ${{ steps.get-changed-files-for-chromatic.outputs.storyFiles == 'false' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user