-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6619 from guardian/jc/apps-chromatic-workflow
- Loading branch information
Showing
3 changed files
with
104 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: AR Chromatic 👓 | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
chromatic: | ||
name: Chromatic | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout - On Pull Request | ||
uses: actions/checkout@v3 | ||
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@v3 | ||
if: ${{ github.event_name == 'push'}} | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: guardian/actions-setup-node@main | ||
|
||
# Cache npm dependencies using https://github.com/bahmutov/npm-install | ||
# Root yarn installs all workspaces (root, common, dotcom) | ||
- uses: bahmutov/npm-install@v1 | ||
|
||
- name: Chromatic - Apps Rendering Non Dependency PR / main | ||
uses: chromaui/action@v1 | ||
if: ${{ github.event_name == 'push' || (!contains(github.event.pull_request.labels.*.name, 'dependencies') && github.event.pull_request.user.login != 'dependabot')}} | ||
with: | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__APPS_RENDERING }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
untraced: '**/(package**.json|yarn.lock)' | ||
exitOnceUploaded: true | ||
onlyChanged: '!(main)' # only turbosnap on non-main branches | ||
workingDir: apps-rendering | ||
|
||
- name: Chromatic - Apps Rendering Dependency PR | ||
uses: chromaui/action@v1 | ||
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'dependencies') || github.event.pull_request.user.login == 'dependabot') }} | ||
with: | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__APPS_RENDERING }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
autoAcceptChanges: main | ||
workingDir: apps-rendering |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: CR Chromatic 👓 | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
chromatic: | ||
name: Chromatic | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout - On Pull Request | ||
uses: actions/checkout@v3 | ||
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@v3 | ||
if: ${{ github.event_name == 'push'}} | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: guardian/actions-setup-node@main | ||
|
||
# Cache npm dependencies using https://github.com/bahmutov/npm-install | ||
# Root yarn installs all workspaces (root, common, dotcom) | ||
- uses: bahmutov/npm-install@v1 | ||
|
||
- name: Chromatic - Common Rendering Non Dependency PR / main | ||
uses: chromaui/action@v1 | ||
if: ${{ github.event_name == 'push' || (!contains(github.event.pull_request.labels.*.name, 'dependencies') && github.event.pull_request.user.login != 'dependabot')}} | ||
with: | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__COMMON_RENDERING }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
workingDir: common-rendering | ||
exitOnceUploaded: true | ||
onlyChanged: '!(main)' # only turbosnap on non-main branches | ||
|
||
- name: Chromatic - Common Rendering Dependency PR | ||
uses: chromaui/action@v1 | ||
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'dependencies') || github.event.pull_request.user.login == 'dependabot') }} | ||
with: | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__COMMON_RENDERING }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
autoAcceptChanges: main | ||
workingDir: common-rendering |
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