Medium headlines for news pillar #22979
Workflow file for this run
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: DCR Chromatic 👓 | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, labeled, synchronize] | |
jobs: | |
chromatic: | |
name: Chromatic | |
runs-on: ubuntu-latest | |
# Run Chromatic only if `run_chromatic` label has been applied or we're | |
# pushing to `main`. Skip if this is a Dependabot PR as this is handled | |
# by the subsequent job. | |
if: | | |
(contains(github.event.pull_request.labels.*.name, 'run_chromatic') || github.ref == 'refs/heads/main') && | |
(!contains(github.event.pull_request.labels.*.name, 'dependencies') && | |
github.event.pull_request.user.login != 'dependabot') | |
steps: | |
- name: Checkout - On Pull Request | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'pull_request'}} | |
with: | |
fetch-depth: 0 | |
# By default the pull_request event will run on a ephermeral merge commit which simulates a merge between the pull request | |
# and the target branch. This can cause issues with Chromatic https://www.chromatic.com/docs/turbosnap#github-pullrequest-triggers | |
# Hopefully by checking out the HEAD commit of a PR instead of the merge commit we can avoid some of those issues. | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Checkout - On Push Event | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'push'}} | |
with: | |
fetch-depth: 0 | |
- name: Set up Node environment | |
uses: ./.github/actions/setup-node-env | |
- name: Chromatic - DCR | |
env: | |
NODE_OPTIONS: '--max_old_space_size=4096' | |
uses: chromaui/[email protected] | |
with: | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__DOTCOM_RENDERING }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
autoAcceptChanges: main | |
onlyChanged: true | |
untraced: '**/(package*.json|pnpm-lock.yaml|preview.js)' | |
workingDir: dotcom-rendering | |
buildScriptName: 'build-storybook' | |
exitOnceUploaded: true | |
remove-label: | |
if: github.ref != 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: chromatic | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Remove run_chromatic label | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
await github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
name: "run_chromatic" | |
}).catch((error) => { | |
// https://docs.github.com/en/rest/issues/labels?apiVersion=2022-11-28#remove-a-label-from-an-issue--status-codes | |
if (error.status === 404) return console.warn("No such label!"); | |
throw error; | |
}) |