Run chromatic on main after PR is merged with proper label (#3909)

This commit is contained in:
Krzysztof Żuraw 2023-07-19 14:14:29 +02:00 committed by GitHub
parent 6cc8f78746
commit c99fa1c5a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---
Run chromatic on main after PR is merged

View file

@ -1,13 +1,28 @@
name: QA name: QA
on: on:
push: pull_request:
branches: branches:
- "main" - main
types: [closed]
jobs: jobs:
if_merged:
permissions:
pull-requests: read
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
outputs:
labels: ${{ steps.get_labels.outputs.labels }}
steps:
- name: Get PR labels
id: get_labels
uses: joerick/pr-labels-action@7beda983e70efd41dd55ef246d0b3bba82820f4c # v1.0.8
chromatic-storybook-main: chromatic-storybook-main:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: if_merged
if: ${{ contains(needs.if_merged.outputs.labels, ' run chromatic ') }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -33,7 +48,6 @@ jobs:
run: npm ci run: npm ci
- name: Publish to Chromatic and auto accept changes - name: Publish to Chromatic and auto accept changes
if: github.ref == 'refs/heads/main'
uses: chromaui/action@a89b674adf766dbde41ad9ea2b2b60b91188a0f0 # v6.17.4 uses: chromaui/action@a89b674adf766dbde41ad9ea2b2b60b91188a0f0 # v6.17.4
with: with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}