Skip to content

chore(deps): bump express from 4.19.2 to 4.21.0 #908

chore(deps): bump express from 4.19.2 to 4.21.0

chore(deps): bump express from 4.19.2 to 4.21.0 #908

name: "Deploy chromatic pull request"
on:
pull_request:
types: [ labeled, synchronize ]
concurrency:
group: chromatic-${{ github.head_ref }}
cancel-in-progress: true
jobs:
deploy_chromatic:
if: "github.event.action == 'labeled' && github.event.label.name == 'need: deploy-chromatic'"
name: "Deploy chromatic"
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
with:
fetch-depth: 0 # retrieve all the repo history (required by chromatic)
- name: "Init variables"
id: vars
uses: actions/github-script@v6
with:
script: |
// Link to the current run on github website
const run_html_url = "${{github.event.repository.html_url}}/actions/runs/${{github.run_id}}?pr=${{github.event.pull_request.number}}";
// StoryBook URL
const utils = require('./.github/actions/utils');
const storybook_url = await utils.getStoryBookURL('${{github.event.pull_request.head.sha}}');
return { run_html_url, storybook_url };
- name: "Update PR body: Deploying state"
uses: ./.github/actions/update-pr-body
with:
pattern: 'StoryBook: .*'
replace: 'StoryBook: [Deploying...](${{fromJSON(steps.vars.outputs.result).run_html_url}})'
whenNotFound: 'append'
keepLastMatch: true
- name: "Setup"
uses: ./.github/actions/setup
- name: "Deploy chromatic"
id: deploy
uses: chromaui/action@3f82bf5d065290658af8add6dce946809ee0f923 #v6.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_TOKEN }}
buildScriptName: build:storybook
onlyChanged: true
#skip: true
- if: "failure()"
name: "Update PR body: Failure state"
uses: ./.github/actions/update-pr-body
with:
pattern: 'StoryBook: .*'
replace: 'StoryBook: [:x: Failed](${{fromJSON(steps.vars.outputs.result).run_html_url}})'
whenNotFound: 'ignore'
keepLastMatch: true
- if: "always() && contains(github.event.pull_request.labels.*.name, 'need: deploy-chromatic')"
name: "Remove label"
uses: ./.github/actions/remove-label
with:
label: "need: deploy-chromatic"
- name: "Update PR body: Deployed state"
uses: ./.github/actions/update-pr-body
with:
pattern: 'StoryBook: .*'
replace: 'StoryBook: ${{fromJSON(steps.vars.outputs.result).storybook_url}} ([Chromatic build](${{steps.deploy.outputs.buildUrl}}))'
whenNotFound: 'append'
keepLastMatch: true
check_up_to_date:
if: "github.event.action == 'synchronize' && contains(github.event.pull_request.body, '\nStoryBook: https')"
name: "Check StoryBook URL is up-to-date"
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Get current short SHA"
id: short_sha
run: echo "short_sha=$(git rev-parse --short ${{github.event.pull_request.head.sha}})" >> $GITHUB_OUTPUT
- name: "Mark storybook URL as outdated"
uses: ./.github/actions/update-pr-body
with:
pattern: 'StoryBook: ((https:\/\/([a-z0-9]+)--[^ ]*).*)'
# Ignore if the short SHA in the storybook URL is up-to-date or if it was already marked as outdated
skipReplaceIf: |
groups[3] === "${{steps.short_sha.outputs.short_sha}}"
|| groups[0].includes("Outdated commit")
replace: 'StoryBook: $1 **⚠️ Outdated commit**'
whenNotFound: 'ignore'
keepLastMatch: true