Post Build & Test #2554
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Post Build & Test | |
on: | |
workflow_run: | |
types: | |
- completed | |
workflows: | |
- 'Build & Test' | |
jobs: | |
# This runs Chromatic visual regression tests without exposing secrets to untrusted code from third-party PRs. | |
# https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/ | |
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | |
Test_visual_regression: | |
runs-on: ubuntu-latest | |
if: github.event.workflow_run.conclusion == 'success' | |
steps: | |
- name: Git clone repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up environment | |
uses: ./.github/actions/prepare-environment | |
- name: Download pre-built Storybook | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { downloadStorybookArtifact } = await import('${{ github.workspace }}/scripts/github-actions/downloadStorybookArtifact.mjs') | |
await downloadStorybookArtifact({ github, context }) | |
- name: Unzip pre-built Storybook | |
run: | | |
unzip storybook-static.zip -d packages/react-component-library/.static_storybook | |
echo "CHROMATIC_SHA=$(<packages/react-component-library/.static_storybook/sha)" >> $GITHUB_ENV | |
echo "CHROMATIC_BRANCH=$(<packages/react-component-library/.static_storybook/branch)" >> $GITHUB_ENV | |
echo "CHROMATIC_SLUG=$(<packages/react-component-library/.static_storybook/slug)" >> $GITHUB_ENV | |
- name: Fetch original ref | |
run: | | |
git fetch origin "+$CHROMATIC_SHA" | |
- name: Run Chromatic | |
uses: chromaui/action@latest | |
with: | |
projectToken: ${{ secrets.CHROMATIC_TOKEN }} | |
workingDir: packages/react-component-library | |
storybookBuildDir: .static_storybook | |
Automerge: | |
name: Merge Dependabot PR's | |
runs-on: ubuntu-latest | |
if: github.actor == 'dependabot[bot]' | |
needs: [Test_visual_regression] | |
steps: | |
- name: Auto merge Dependabot minor and patch version bumps | |
uses: Royal-Navy/design-system-mergeme-action@master | |
with: | |
GITHUB_TOKEN: ${{ secrets.MERGE_BOT }} | |
PRESET: DEPENDABOT_MINOR |