Move Chromatic to more secure execution model (#10449)

* Move Chromatic to more secure execution model

* Remove a permission we don't need here
This commit is contained in:
Matt Bishop 2024-08-13 09:08:09 -04:00 committed by GitHub
parent baf919a4e3
commit c3c0c72792
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 9 deletions

View File

@ -1,25 +1,35 @@
---
name: Chromatic name: Chromatic
on: on:
push: push:
branches-ignore: branches:
- 'renovate/**' - "main"
paths-ignore: - "rc"
- '.github/workflows/**' - "hotfix-rc"
pull_request_target:
types: [opened, synchronize]
jobs: jobs:
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main
chromatic: chromatic:
name: Chromatic name: Chromatic
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: check-run
permissions:
contents: read
pull-requests: write
steps: steps:
- name: Checkout repo - name: Check out repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with: with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 fetch-depth: 0
- name: Get Node Version - name: Get Node version
id: retrieve-node-version id: retrieve-node-version
run: | run: |
NODE_NVMRC=$(cat .nvmrc) NODE_NVMRC=$(cat .nvmrc)
@ -31,7 +41,7 @@ jobs:
with: with:
node-version: ${{ steps.retrieve-node-version.outputs.node_version }} node-version: ${{ steps.retrieve-node-version.outputs.node_version }}
- name: Cache npm - name: Cache NPM
id: npm-cache id: npm-cache
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
with: with:
@ -41,7 +51,7 @@ jobs:
- name: Install Node dependencies - name: Install Node dependencies
run: npm ci run: npm ci
# Manual build the storybook to resolve a chromatic/storybook bug related to TurboSnap # Manually build the Storybook to resolve a bug related to TurboSnap
- name: Build Storybook - name: Build Storybook
run: npm run build-storybook:ci run: npm run build-storybook:ci